PDA

View Full Version : checkbox in list don't work?Is it a bug?



zhangwl
5 Dec 2010, 10:47 PM
In sencha touch list demo, I add a checkbox in list, It don't be showed in list ,why?

Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});
demos.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName')[0];
},
data: [
{firstName: 'Julio', lastName: 'Benesh'},
{firstName: 'Julio', lastName: 'Minich'},
{firstName: 'Tania', lastName: 'Ricco'},
{firstName: 'Odessa', lastName: 'Steuck'},
{firstName: 'Nelson', lastName: 'Raber'},
{firstName: 'Tyrone', lastName: 'Scannell'},
{firstName: 'Allan', lastName: 'Disbrow'},
{firstName: 'Cody', lastName: 'Herrell'},
{firstName: 'Julio', lastName: 'Burgoyne'},
{firstName: 'Jessie', lastName: 'Boedeker'},
{firstName: 'Allan', lastName: 'Leyendecker'},
{firstName: 'Javier', lastName: 'Lockley'},
{firstName: 'Guy', lastName: 'Reasor'},
{firstName: 'Jamie', lastName: 'Brummer'},
{firstName: 'Jessie', lastName: 'Casa'},
{firstName: 'Marcie', lastName: 'Ricca'},
{firstName: 'Gay', lastName: 'Lamoureaux'},
{firstName: 'Althea', lastName: 'Sturtz'},
{firstName: 'Kenya', lastName: 'Morocco'},
{firstName: 'Rae', lastName: 'Pasquariello'},
{firstName: 'Ted', lastName: 'Abundis'},
{firstName: 'Jessie', lastName: 'Schacherer'},
{firstName: 'Jamie', lastName: 'Gleaves'},
{firstName: 'Hillary', lastName: 'Spiva'},
{firstName: 'Elinor', lastName: 'Rockefeller'},
{firstName: 'Dona', lastName: 'Clauss'},
{firstName: 'Ashlee', lastName: 'Kennerly'},
{firstName: 'Alana', lastName: 'Wiersma'},
{firstName: 'Kelly', lastName: 'Holdman'},
{firstName: 'Mathew', lastName: 'Lofthouse'},
{firstName: 'Dona', lastName: 'Tatman'},
{firstName: 'Clayton', lastName: 'Clear'},
{firstName: 'Rosalinda', lastName: 'Urman'},
{firstName: 'Cody', lastName: 'Sayler'},
{firstName: 'Odessa', lastName: 'Averitt'},
{firstName: 'Ted', lastName: 'Poage'},
{firstName: 'Penelope', lastName: 'Gayer'},
{firstName: 'Katy', lastName: 'Bluford'},
{firstName: 'Kelly', lastName: 'Mchargue'},
{firstName: 'Kathrine', lastName: 'Gustavson'},
{firstName: 'Kelly', lastName: 'Hartson'},
{firstName: 'Carlene', lastName: 'Summitt'},
{firstName: 'Kathrine', lastName: 'Vrabel'},
{firstName: 'Roxie', lastName: 'Mcconn'},
{firstName: 'Margery', lastName: 'Pullman'},
{firstName: 'Avis', lastName: 'Bueche'},
{firstName: 'Esmeralda', lastName: 'Katzer'},
{firstName: 'Tania', lastName: 'Belmonte'},
{firstName: 'Malinda', lastName: 'Kwak'},
{firstName: 'Tanisha', lastName: 'Jobin'},
{firstName: 'Kelly', lastName: 'Dziedzic'},
{firstName: 'Darren', lastName: 'Devalle'},
{firstName: 'Julio', lastName: 'Buchannon'},
{firstName: 'Darren', lastName: 'Schreier'},
{firstName: 'Jamie', lastName: 'Pollman'},
{firstName: 'Karina', lastName: 'Pompey'},
{firstName: 'Hugh', lastName: 'Snover'},
{firstName: 'Zebra', lastName: 'Evilias'}
]
});
demos.List = new Ext.TabPanel ({
items: [{
title: 'Simple',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: 500,
xtype: 'list',
store: demos.ListStore,
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}<input type="checkbox" checked="true" id="{firstName}"/>abc</div>'
}]
}, {
title: 'Grouped',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: 500,
xtype: 'list',
store: demos.ListStore,
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}</div>',
grouped: true,
indexBar: true
}]
}, {
title: 'Disclosure',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: Ext.is.Phone ? undefined : 500,
xtype: 'list',
onItemDisclosure: function(record, btn, index) {
Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName'), Ext.emptyFn);
},
store: demos.ListStore, //getRange(0, 9),
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}</div>'
}]
}]
});

zhangwl
5 Dec 2010, 10:54 PM
in sencha touch list example, I add a checkbox in list, checkbox don't be showed in list, why?
code:

Ext.regModel('Contact', {
fields: ['firstName', 'lastName']
});

demos.ListStore = new Ext.data.Store({
model: 'Contact',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName')[0];
},
data: [
{firstName: 'Julio', lastName: 'Benesh'},
{firstName: 'Julio', lastName: 'Minich'},
{firstName: 'Tania', lastName: 'Ricco'},
{firstName: 'Odessa', lastName: 'Steuck'},
{firstName: 'Nelson', lastName: 'Raber'},
{firstName: 'Tyrone', lastName: 'Scannell'},
{firstName: 'Allan', lastName: 'Disbrow'},
{firstName: 'Cody', lastName: 'Herrell'},
{firstName: 'Julio', lastName: 'Burgoyne'},
{firstName: 'Jessie', lastName: 'Boedeker'},
{firstName: 'Allan', lastName: 'Leyendecker'},
{firstName: 'Javier', lastName: 'Lockley'},
{firstName: 'Guy', lastName: 'Reasor'},
{firstName: 'Jamie', lastName: 'Brummer'},
{firstName: 'Jessie', lastName: 'Casa'},
{firstName: 'Marcie', lastName: 'Ricca'},
{firstName: 'Gay', lastName: 'Lamoureaux'},
{firstName: 'Althea', lastName: 'Sturtz'},
{firstName: 'Kenya', lastName: 'Morocco'},
{firstName: 'Rae', lastName: 'Pasquariello'},
{firstName: 'Ted', lastName: 'Abundis'},
{firstName: 'Jessie', lastName: 'Schacherer'},
{firstName: 'Jamie', lastName: 'Gleaves'},
{firstName: 'Hillary', lastName: 'Spiva'},
{firstName: 'Elinor', lastName: 'Rockefeller'},
{firstName: 'Dona', lastName: 'Clauss'},
{firstName: 'Ashlee', lastName: 'Kennerly'},
{firstName: 'Alana', lastName: 'Wiersma'},
{firstName: 'Kelly', lastName: 'Holdman'},
{firstName: 'Mathew', lastName: 'Lofthouse'},
{firstName: 'Dona', lastName: 'Tatman'},
{firstName: 'Clayton', lastName: 'Clear'},
{firstName: 'Rosalinda', lastName: 'Urman'},
{firstName: 'Cody', lastName: 'Sayler'},
{firstName: 'Odessa', lastName: 'Averitt'},
{firstName: 'Ted', lastName: 'Poage'},
{firstName: 'Penelope', lastName: 'Gayer'},
{firstName: 'Katy', lastName: 'Bluford'},
{firstName: 'Kelly', lastName: 'Mchargue'},
{firstName: 'Kathrine', lastName: 'Gustavson'},
{firstName: 'Kelly', lastName: 'Hartson'},
{firstName: 'Carlene', lastName: 'Summitt'},
{firstName: 'Kathrine', lastName: 'Vrabel'},
{firstName: 'Roxie', lastName: 'Mcconn'},
{firstName: 'Margery', lastName: 'Pullman'},
{firstName: 'Avis', lastName: 'Bueche'},
{firstName: 'Esmeralda', lastName: 'Katzer'},
{firstName: 'Tania', lastName: 'Belmonte'},
{firstName: 'Malinda', lastName: 'Kwak'},
{firstName: 'Tanisha', lastName: 'Jobin'},
{firstName: 'Kelly', lastName: 'Dziedzic'},
{firstName: 'Darren', lastName: 'Devalle'},
{firstName: 'Julio', lastName: 'Buchannon'},
{firstName: 'Darren', lastName: 'Schreier'},
{firstName: 'Jamie', lastName: 'Pollman'},
{firstName: 'Karina', lastName: 'Pompey'},
{firstName: 'Hugh', lastName: 'Snover'},
{firstName: 'Zebra', lastName: 'Evilias'}
]
});

demos.List = new Ext.TabPanel ({
items: [{
title: 'Simple',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: 500,
xtype: 'list',
store: demos.ListStore,
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}<input type="checkbox" checked="true" id="{firstName}"/>abc</div>'
}]
}, {
title: 'Grouped',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: 500,
xtype: 'list',
store: demos.ListStore,
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}</div>',
grouped: true,
indexBar: true
}]
}, {
title: 'Disclosure',
layout: Ext.is.Phone ? 'fit' : {
type: 'vbox',
align: 'center',
pack: 'center'
},
cls: 'demo-list',
items: [{
width: Ext.is.Phone ? undefined : 300,
height: Ext.is.Phone ? undefined : 500,
xtype: 'list',
onItemDisclosure: function(record, btn, index) {
Ext.Msg.alert('Tap', 'Disclose more info for ' + record.get('firstName'), Ext.emptyFn);
},
store: demos.ListStore, //getRange(0, 9),
itemTpl: '<div class="contact"><strong>{firstName}</strong> {lastName}</div>'
}]
}]
});