PDA

View Full Version : multiselect / checkbox xtemplate



rajivpa
5 Jan 2011, 2:37 PM
Hi
I need to display a list of accounts to the user and user should be able to select multiple accounts. I thought of using select field with multiselect: true, but that does not work.

As a workaround I am thinking of having the accounts as sencha touch checkbox. But I need to dynamically create this list of checkbox from a JsonStore, I dont know how to do it, but from what I read about ExtJs I would probably need xtemplate?

I am a newbie, am in a right direction ? Can you please suggest or direct me to such sample code or any other pointers will be really helpful.
Thanks
Rajiv

ShatyUT
6 Jan 2011, 2:35 PM
I've seen a suggestion where you create a <div id="someid"></div> for each element you want and then when the appropriate event is triggered (maybe afterrender?) you can build your checkboxes and use the "renderTo" config option to say which div should hold each.

The other option, which is one I am using, is to render an <input> element directly in the XTemplate:



new Ext.XTemplate(
'<tpl for=".">',
'<div class="row-wrap" id="row{id}">',
'<span class="cell1">{field1}</span>',
'<input class="hradio" type="radio" name="radio{id}" />',
'<span class="cell3">{field3}</span>',
'<input class="vradio" type="radio" name="radio{id}" />',
'<span class="cell5">{field5}</span>',
'<span class="cell6">{field6}</span>',
'</div>',
'</tpl>'
});

rajivpa
6 Jan 2011, 10:00 PM
Thanks