Good morning,
I need to make some fields Editable and some not (enabled or not) due some condition. But it doesn't works.
What I did?
1.- on the diff block I replace on every field block:
replace "enabled": true by "enabled": { "bindTo": "isUsrGiroEnabled" }, for example:
{
"operation": "insert",
"name": "STRINGe657cf87-7461-450e-beb8-8429d591a8ea",
"values": {
"layout": {
"colSpan": 12,
"rowSpan": 1,
"column": 0,
"row": 0,
"layoutName": "ProductsTabGridLayout30090ad7"
},
"bindTo": "UsrGiro",
"enabled": { "bindTo": "isUsrGiroEnabled" } // Replaced "enabled": true
},
"parentName": "ProductsTabGridLayout30090ad7",
"propertyName": "items",
"index": 0
},
2.- Create an onEntityInitialized method to call when the form loads the method evaluate the fileds must be filled or not. (Enabled)
onEntityInitialized: function() { //callback, scope) {
this.callParent(arguments);
this.isCampoEnabled();
},
The method that evaluate if a field is Editable or not
isCampoEnabled: function() {
// Evalua Tipo de Negocio
var tipoNegocio = this.get( "UsrLineaNeg" ).displayValue;
var tipoNegocioCCV = ( tipoNegocio.substring( 0, 2 ) === "CCV" ) ? true : false;
var tipoNegocioOficinas = ( tipoNegocio.substring( 0, 2 ) === "Ofi" ) ? true : false;
var tipoNegocioIndustrial = ( tipoNegocio.substring( 0, 2 ) === "Ind" ) ? true : false;
var tipoNegocioMALL = ( tipoNegocio.substring( 0, 2 ) === "Mal" ) ? true : false;
// Campos que SIEMPRE SON HABILITADOS
this.set( "IsUsrRubroEnabled", true );
this.set( "IsUsrGiroEnabled", true );
if ( tipoNegocioCCV ) {
// Deshabilida sólo los de CCV
this.set( "IsUsrRepLegal1Enabled", false );
// the same to another fields
}
}
What's missing?, it doesn't works. ALL fields set NOT Editable.
Thankjs in advance