Вопрос

Привязка названия к атрибуту в разделе

 Пытаюсь привязать аттрибут TimerCaption  к значению кнопки, но почему то не получается это сделать, при этом если привязывать таким же способом аттрибут к видимости все работает нормально, подскажите , где я ошибся?

define("ActivitySectionV2", [], function () {
    return {
        entitySchemaName: "Activity",
        details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
        attributes: {},
        diff: /**SCHEMA_DIFF*/[
            { // добавление самой кнопки
                "operation": "insert",
                "name": "DataGridActiveRowCallTimer",
                "parentName": "DataGrid",
                "propertyName": "activeRowActions",
                "values": {
                    "className": "Terrasoft.Button",
                    "style": Terrasoft.controls.ButtonEnums.style.GREEN,
                    "caption": {
						"bindTo": "TimerCaption"
					},
                    "tag": "onCallTimer",
                    "visible": true
                }
            }
        ]/**SCHEMA_DIFF*/,
        methods: {
            setCaptionTimer: function (state) {
                const caption = state ? this.get("Resources.Strings.TimerOnButtonCaption") : this.get("Resources.Strings.TimerOffButtonCaption");
 
                this.set("TimerCaption", caption);
            },
 
            onActiveRowAction: function (buttonTag, primaryColumnValue) {
                const activeRow = this.getActiveRow();
                const activeRowId = activeRow.get("Id");
                switch (buttonTag) {
                    case "onCallTimer":         
                        this.callActivityTimerService(activeRowId);
                        break;
                    default:
                        this.callParent(arguments);
                        break;
                }
            },
 
            onActiveRowChange: function() {
				var gridData = this.getGridData();
				var activeRow = this.get("ActiveRow");
				if(gridData && activeRow) {
					var currentRow = gridData.get(activeRow); 
                    this.setCaptionTimer(true);
					return;
				}
			},
        }
    };
});

 

Нравится

2 комментария

Добрый день!

В вашем случае будет лучше работать напрямую с локализируемыми строками.

"caption": { bindTo: "Resources.Strings.TimerOnButtonCaption" },



init: function () {

                this.callParent(arguments);

                this.set("Resources.Strings.TimerOnButtonCaption", "NewValue")

            },

Дима Вовченко,

проблема в том, что даже с строками не работает(

только если явно указать значение(

Показать все комментарии