-
4 Nov 2011 12:17 PM #1
Answered: Grouped list does not display
Answered: Grouped list does not display
I do not understand why this "grouped list" does not work. If you remove "grouped: true" from the config, it displays but otherwise doesn't. It appears to be a bug in PR1 but I'm not sure. Thoughts?
Code:Ext.regModel('Employee', { fields: ['firstName', 'lastName'] }); Ext.define('EmployeeListStore', { extend: 'Ext.data.Store', model: 'Employee', sorters: 'firstName', getGroupString : function(record) { return record.get('firstName'); }, data: [ {firstName: 'Penelope', lastName: 'Gayer'}, {firstName: 'Katy', lastName: 'Bluford'}, {firstName: 'Kelly', lastName: 'Mchargue'}, {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'} ] }); Ext.application({ name: 'GroupedListTest', launch: function() { console.log('launch:'); var myPanel = Ext.create("Ext.Panel", { fullscreen: true, layout: 'fit', items: [ { title: 'Grouped', layout: 'fit', items: [{ id: 'employeesList', xtype: 'list', store: 'theEmployeeStore', itemTpl: '<strong>{firstName}</strong> {lastName}', grouped: true, indexBar: false }] } ] }); console.log('myPanel=' + myPanel); var employeesList = myPanel.down('#employeesList'); console.log('employeesList=' + employeesList); myStore = new EmployeeListStore(); console.log('myStore=' + myStore); employeesList.setStore(myStore); console.log('employeesList.getStore()=' + employeesList.getStore()); } });
-
Best Answer Posted by SunboX
Looking at your Code, I found your fault:
You defined an invalid store. Sencha tries to call store.on({}) on an store that doesn´t exist.Code:store: 'myXYZStore'
This code will work:
greetings Sunny (your debugger ;o))PHP Code:Ext.regModel('Employee', {
fields: ['firstName', 'lastName']
});
Ext.define('EmployeeListStore', {
extend: 'Ext.data.Store',
model: 'Employee',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName');
},
data: [
{firstName: 'Penelope', lastName: 'Gayer'},
{firstName: 'Katy', lastName: 'Bluford'},
{firstName: 'Kelly', lastName: 'Mchargue'},
{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'}
]
});
Ext.application({
name: 'GroupedListTest',
launch: function() {
console.log('launch:');
myStore = new EmployeeListStore();
console.log('myStore=' + myStore);
var myPanel = Ext.create("Ext.Panel", {
fullscreen: true,
layout: 'fit',
items: [
{
title: 'Grouped',
layout: 'fit',
items: [{
id: 'employeesList',
xtype: 'list',
store: myStore,
itemTpl: '<strong>{firstName}</strong> {lastName}',
grouped: true,
indexBar: false
}]
}
]
});
console.log('myPanel=' + myPanel);
var employeesList = myPanel.down('#employeesList');
console.log('employeesList=' + employeesList);
//employeesList.setStore(myStore);
console.log('employeesList.getStore()=' + employeesList.getStore());
}
});
-
6 Nov 2011 1:08 PM #2
There are some bugs with List and Store and grouped headers in PR1. Try to refresh() the List, after the setStore() call. Should fix it. If it doesn´t work, try calling refresh() two times!
-
6 Nov 2011 8:14 PM #3
-
7 Nov 2011 2:59 AM #4
If I run your example I get this error message:
greetings SunnyCode:sencha-touch-all-debug.js:59201 Uncaught TypeError: Cannot call method 'on' of null
-
7 Nov 2011 3:04 AM #5
Looking at your Code, I found your fault:
You defined an invalid store. Sencha tries to call store.on({}) on an store that doesn´t exist.Code:store: 'myXYZStore'
This code will work:
greetings Sunny (your debugger ;o))PHP Code:Ext.regModel('Employee', {
fields: ['firstName', 'lastName']
});
Ext.define('EmployeeListStore', {
extend: 'Ext.data.Store',
model: 'Employee',
sorters: 'firstName',
getGroupString : function(record) {
return record.get('firstName');
},
data: [
{firstName: 'Penelope', lastName: 'Gayer'},
{firstName: 'Katy', lastName: 'Bluford'},
{firstName: 'Kelly', lastName: 'Mchargue'},
{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'}
]
});
Ext.application({
name: 'GroupedListTest',
launch: function() {
console.log('launch:');
myStore = new EmployeeListStore();
console.log('myStore=' + myStore);
var myPanel = Ext.create("Ext.Panel", {
fullscreen: true,
layout: 'fit',
items: [
{
title: 'Grouped',
layout: 'fit',
items: [{
id: 'employeesList',
xtype: 'list',
store: myStore,
itemTpl: '<strong>{firstName}</strong> {lastName}',
grouped: true,
indexBar: false
}]
}
]
});
console.log('myPanel=' + myPanel);
var employeesList = myPanel.down('#employeesList');
console.log('employeesList=' + employeesList);
//employeesList.setStore(myStore);
console.log('employeesList.getStore()=' + employeesList.getStore());
}
});
-
7 Nov 2011 7:04 AM #6


Reply With Quote