javascript - Load columns from different file extjs -


i have many grid this. want make base grid , columns loaded js file. possible in extjs4?

ext.define('app.view.mygrid', {     extend : 'ext.grid.panel',     alias : 'widget.resultslist',     id : 'mygrid',     header : false,     columnlines : true,     initcomponent : function() {     this.store = 'mystore';     this.columns = [             // can loaded file     ]   } }); 

not sure if best way, can use mixin that:

ext.define('app.mixin.mygridcolumnsmixin',{   getcolumns : function() {      return [{}]; //your columns here   } });  ext.define('app.view.mygrid',{   requires : ['app.mixin.mygridcolumnsmixin'],   mixins : ['app.mixin.mygridcolumnsmixin'],   initcomponent : function() {     var me = this,         columns = me.getcolumns(); //method of mixin     //applying list of columns in component     ext.applyif(me, {       columns: columns     });     me.callparent(arguments);   }  }); 

Comments

Popular posts from this blog

c++ - CryptStringToBinary API behavior -

c++ - Correct method for redrawing a layered window -

java.util.scanner - How to read and add only numbers to array from a text file -