PDA

View Full Version : Checklist



Flix
15 Jun 2011, 12:28 PM
I try a to create a list with green checked or gray unchecked pictures in every item. If I click on the item, the checked-status should change.

If I used a list with itemTpl, but there I can't access the store data. So I tried the tpl. This works, but now there is no itemtap-Event. Now I tried to use a html-Code onclick-Event. This works, but I only can access external functions without store access.

here is the code:


var chkWlist = new Ext.List({
fullscreen: true,
xtype: 'list',
checkField: 'schongemacht',
displayField: 'WorkshopName',
trueValue: true,
falseValue: false,
grouped : false,
indexBar: false,
ui:'dark',
itemTpl : '', // wird eh überschrieben
store: store,

listeners: {


beforerender: function(){
this.tpl = new Ext.XTemplate(
'<tpl for="."><div class="x-checklist" style="padding: .5em; margin-right:2px;font-size: 18px;border-top: 1px solid white; border-bottom: 1px solid #eaeaea" onclick="changeWorkshopSel({#})"><img src="Pics/{[ values.' + this.checkField + '==' + this.trueValue + '? "check.png" : "uncheck.png"]}" height="15" width="15" /> {' + this.displayField + '}</div></tpl>',
// changeWorkshopSel is an external function and can't access the store-data
{
checkField: this.checkField,
trueValue: this.trueValue,
displayField: this.displayField
});
this.refresh();
}
}
});




I hope you can halp me
Flix

steve1964
15 Jun 2011, 1:55 PM
Hi, take a look at this post, the showcase app have a list with checbox:
http://www.sencha.com/forum/showthread.php?137117-Video-Code-Building-a-sample-MVC-Sencha-Touch-app

Flix
19 Jun 2011, 10:12 AM
thank you