extjs3 - How to create multiple instances of a class in extjs -
i create class of button
, want button appear on number of selection in checkbox. right button appearing 1 though selected multiple checkbox. far done
- i creating button class.
- added array
placing array in items of panel.
button class
record = ext.extend(ext.container,{ initcomponent: function(){ var p=this; p.bodypadding = 5; p.margin = '5 5 0 3'; p.layout = 'anchor'; p.items = [{ xtype: 'button', text : 'hello }]; record.superclass.initcomponent.apply(this, arguments); }});
adding array in function :
getrecords: function () { var recitems[]; reclength = ext.getcmpby('rec').length var clsname; clsname = new record (), for(var i=0;i<reclength; i++){ var item = ext.create(clsname,{ }); recitems.push(item); } return recitems; }
calling in panel
{xtype:'panel', title : "records", bodystyle: 'background: #dfe8f6;border:#dfe8f6;', autoscroll: true, region: 'center', layout:{ type: 'anchor', pack: 'start', align: 'stretch' }, items: p.getrecords() }
Comments
Post a Comment