javascript - Cascading the convert function for a nested model in ExtJS 5 -
i have grid i'd fill translatable strings in extjs 5. in past i've translated strings using convert method, in case need translations in nested model , convert method firing @ top level. ideas on making cascade?
ext.define('application.model.messageconfig', { extend : "application.model.base", fields: [ { name: 'messagetype', reference: 'messagetype', unique: true }, { name: 'subscribedapp', type: 'boolean' }, { name: 'subscribedemail', type: 'boolean' } ] }); ext.define('application.model.messagetype', { extend : "application.model.base", mixins: [ 'elsevier.localization.translate.util' ], constructor: function(){ this.inittranslate(); this.callparent(arguments); }, fields: [ { name: 'messagetypeid', type: 'int' }, { name: 'status', type: 'string' }, { name: 'reftablecategory', type: 'reftable' }, { name: 'nametranslationkey', type: 'string', convert: function (value, data){ debugger; var code = data.get('nametranslationkey'); if(code) { return data.i18n[code]; } return ''; } }, { name: 'descriptiontranslationkey', type: 'string', convert: function (value, data){ var code = data.get('descriptiontranslationkey'); if(code) { return data.i18n[code]; } return ''; } }, { name: 'manageable', type: 'boolean' }, { name: 'modifiableapp', type: 'boolean' }, { name: 'modifiableemail', type: 'boolean' }, { name: 'defaultsubscriptionapp', type: 'boolean' }, { name: 'defaultsubscriptionemail', type: 'boolean' }, { name: 'type', type: 'string', } ], belongsto: 'messagesconfig' });
Comments
Post a Comment