Коллеги доброго времени суток!
Реализовал деталь с редактируемым реестром и карточкой редактирования записи код ниже:
define("AbAccountProductDetail",
["ConfigurationEnums", "ConfigurationGrid", "ConfigurationGridGenerator", "ConfigurationGridUtilities"],
function (enums) {
return {
entitySchemaName: "AbAccountProduct",
attributes: {
"IsEditable": {
dataValueType: Terrasoft.DataValueType.BOOLEAN,
type: Terrasoft.ViewModelColumnType.VIRTUAL_COLUMN,
value: true
}
},
mixins: {
ConfigurationGridUtilities: "Terrasoft.ConfigurationGridUtilities"
},
methods:{
init: function() {
this.callParent(arguments);
this.sandbox.subscribe("[AbAccountProductEntityEventListner]:[RequestToPlatform]:[Exception]", this.accountProductEntityListnerMsgHandler, this);
},
/*Overrided "BaseGridDetailV2"*/
editRecord: function(record) {
var activeRow = record || this.getActiveRow();
if (!activeRow) {
return;
}
if (!this.getIsCardValid()) {
return;
}
var isCardChanged = this.getIsCardChanged();
var primaryColumnValue = typeof activeRow === "object" ? activeRow.get(activeRow.primaryColumnName) : activeRow;
var typeColumnValue = this.getTypeColumnValue(activeRow);
this.setLastActiveRow(primaryColumnValue);
if (isCardChanged) {
this.set("CardState", enums.CardStateV2.EDIT);
this.set("EditPageUId", typeColumnValue);
this.set("PrimaryValueUId", primaryColumnValue);
var args = {
isSilent: true,
messageTags: [this.sandbox.id]
};
this.sandbox.publish("SaveRecord", args, [this.sandbox.id]);
} else {
this.openCard(enums.CardStateV2.EDIT, typeColumnValue, primaryColumnValue);
}
},
accountProductEntityListnerMsgHandler: function() {
Terrasoft.ServerChannel.on(Terrasoft.EventName.ON_MESSAGE,
function(scope, message){
if (!message || message.Header.Sender !== "[AbAccountProductEntityEventListner]:[RequestToPlatform]:[Exception]") {
return;
}
var message2 = message.Body;
if (!this.Ext.isEmpty(message2)) {
window.console.info(message2);
this.Terrasoft.showInformation(message2);
}
}, this);
}
},
diff: [
{
"operation": "merge",
"name": "DataGrid",
"values": {
"className": "Terrasoft.ConfigurationGrid",
"generator": "ConfigurationGridGenerator.generatePartial",
"generateControlsConfig": { "bindTo": "generateActiveRowControlsConfig" },
"changeRow": { "bindTo": "changeRow" },
"unSelectRow": { "bindTo": "unSelectRow" },
"onGridClick": { "bindTo": "onGridClick" },
"activeRowActions": [
{
"className": "Terrasoft.Button",
"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
"tag": "save",
"markerValue": "save",
"imageConfig": { "bindTo": "Resources.Images.SaveIcon" }
},
{
"className": "Terrasoft.Button",
"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
"tag": "card",
"markerValue": "card",
"imageConfig": { "bindTo": "Resources.Images.CardIcon" }
},
{
"className": "Terrasoft.Button",
"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
"tag": "cancel",
"markerValue": "cancel",
"imageConfig": { "bindTo": "Resources.Images.CancelIcon" }
},
{
"className": "Terrasoft.Button",
"style": this.Terrasoft.controls.ButtonEnums.style.TRANSPARENT,
"tag": "remove",
"markerValue": "remove",
"imageConfig": { "bindTo": "Resources.Images.RemoveIcon" }
}
],
"initActiveRowKeyMap": { "bindTo": "initActiveRowKeyMap" },
"activeRowAction": { "bindTo": "onActiveRowAction" },
"multiSelect": false
}
}
]
};
});
Пришлось переопределить editRecord():
var primaryColumnValue = typeof activeRow === "object" ? activeRow.get(activeRow.primaryColumnName) : activeRow;
т.к. дальше не срабатывало.
сейчас работает - http://prntscr.com/lfe61n
но при переходе на страницу редактирования поле для связи не заполняется - http://prntscr.com/lfe6k4
Подскажите в чем может быть дело?
Заранее благодарен.