Добрый день.
Версия 7.9.0
Но пример для страницы редактирования раздела. Может я не в ту схему вставляю методы? Или же я просто не вижу ошибку которую допускаю ? Буду признателен за подсказку
define("UsrUsrOrderOnField1Page", [], function() {
return {
entitySchemaName: "UsrOrderOnField",
details: /**SCHEMA_DETAILS*/{}/**SCHEMA_DETAILS*/,
attributes: {
"UsrReservRemains": {
dataValueType: Terrasoft.DataValueType.INTEGER,
dependencies: [
{
columns: ["UsrQuantity"],
methodName: "calculateUsrReservRemains"
}
]
}
},
diff: /**SCHEMA_DIFF*/[
{
"operation": "insert",
"name": "UsrQuantityWorkOrdere",
"values": {
"layout": { "colSpan": 12,"rowSpan": 1,"column": 12,"row": 4,"layoutName": "Header"},
"bindTo": "UsrQuantityWorkOrder"
},
"parentName": "Header",
"propertyName": "items",
"index": 4
},
{
"operation": "insert",
"name": "UsrQuantity",
"values": {
"layout": {"colSpan": 12,"rowSpan": 1,"column": 0,"row": 3,"layoutName": "Header"
},
"bindTo": "UsrQuantity"
},
"parentName": "Header",
"propertyName": "items",
"index": 5
},
{
"operation": "insert",
"name": "UsrReservRemains",
"values": {
"layout": {"colSpan": 12,"rowSpan": 1,"column": 0,"row": 4,"layoutName": "Header"
},
"bindTo": "UsrReservRemains"
},
"parentName": "Header",
"propertyName": "items",
"index": 6
},
{
"operation": "insert",
"name": "UsrToWorkOrder",
"values": {
"layout": {"colSpan": 12,"rowSpan": 1,"column": 12,"row": 3,"layoutName": "Header"
},
"bindTo": "UsrToWorkOrder"
},
"parentName": "Header",
"propertyName": "items",
"index": 7
}
]/**SCHEMA_DIFF*/,
methods: {
calculateUsrReservRemains: function() {
if (!this.get("UsrLastQuantity")) {
this.set("UsrLastQuantity", 0);
}
if (!this.get("UsrReservRemains")) {
this.set("UsrReservRemains", 0);
}
var result = this.get("UsrReservRemains") + this.get("UsrQuantity") - this.get("UsrLastQuantity");
this.set("UsrReservRemains", result);
this.set("UsrLastQuantity", this.get("UsrQuantity"));
},
quantityVlidator: function() {
var invalidMessage = "";
if (this.get("UsrQuantity") this.get("UsrReservRemains")) {
invalidMessage = this.get("Resources.Strings.ValueOfReservGraterThenQuantity");
}
return {
fullInvalidMessage: invalidMessage
invalidMessage: invalidMessage
};
},
setValidationConfig: function() {
this.callParent(arguments);
this.addColumnValidator("UsrQuantity", this.quantityVlidator);
this.addColumnValidator("UsrReservRemains", this.quantityVlidator);
}
},
rules: {}
};
});