View Full Version : Rendering an ext checkbox into an itemTpl?

8 Nov 2012, 9:55 AM
Is there a way to render a checkbox into an itemTpl? In ST2.1.0, there's no event that fires after the list data is rendered, so I can't post-process with renderTo. I think there has to be a way to render to some fake element and grab the HTML, but I can't figure out anything that works.

I need something like this:

{xtype:'list', itemTpl:'{[renderCheckbox()]}}

Has anyone done anything like this before?

8 Nov 2012, 1:01 PM
Adding Widget to a DataView is a pain in the ass.
The API looks awfull (dataMap really ?? ). Hopefully the ST team will fix this in the future.

8 Nov 2012, 1:03 PM
I used to just use renderTo in the initialize event of the list, but that broken in ST2.1.0.

This bug here (http://www.sencha.com/forum/showthread.php?248423-2.1.0-List-events-fire-before-store-data-is-loaded-and-rendered.) was closed without resolution, so I don't know what to do.

10 Nov 2012, 5:27 AM
Using components in dataview (or now list) isn't hard at all but the DOM can bloat up. If you don't want to use components then just have a <div> and style it as a checkbox.

10 Nov 2012, 10:06 AM
The list is pretty small, so it seems to be okay. Do you have example of using components in a list/dataview? That's *exactly* what I'm trying to do, and it would be way cleaner if I didn't have to post-process with renderTo.

10 Nov 2012, 3:22 PM
The Kiva example uses components in dataview. The same thing can happen with the list except you use ListItem instead of DataItem.