ThiemNguyen
15 Oct 2011, 10:26 PM
It seems so easy. Actually I got it on ST 1 but haven't got it on ST2 yet. :(
This is the example code snippet for Ext.List component from the ST2 Docs:
Ext.regModel('Contact', { fields: ['firstName', 'lastName']
});
var store = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',
getGroupString: function(record) {
return record.get('lastName')[0];
},
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Jacky', lastName: 'Nguyen'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'},
{firstName: 'Nigel', lastName: 'White'},
{firstName: 'Don', lastName: 'Griffin'},
{firstName: 'Nico', lastName: 'Ferrero'},
{firstName: 'Nicolas', lastName: 'Belmonte'},
{firstName: 'Jason', lastName: 'Johnston'}
]
});
var list = new Ext.List({
fullscreen: true,
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
store: store
});
I want to create a Ext.Panel component containing that list and other components (I simplified from my app by creating a dummy toolbar named "something").
Here's what I wrote:
Ext.regModel('Contact', { fields: ['firstName', 'lastName']
});
var store = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',
getGroupString: function(record) {
return record.get('lastName')[0];
},
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Jacky', lastName: 'Nguyen'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'},
{firstName: 'Nigel', lastName: 'White'},
{firstName: 'Don', lastName: 'Griffin'},
{firstName: 'Nico', lastName: 'Ferrero'},
{firstName: 'Nicolas', lastName: 'Belmonte'},
{firstName: 'Jason', lastName: 'Johnston'}
]
});
var list = new Ext.List({
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
store: store
});
var home = Ext.create('Ext.Panel',{
fullscreen: true,
scrollable: 'vertical',
items: [{xtype:'toolbar',docked:'top',title:'something'},list]
});
Then the panel with docked toolbar displays normally but the list does not.
Using Chrome element inspector, I see that the list is wrapped in a div with classnames "x-container x-list" with height set to 0. :(
I tried some other ways, like fullscreen: true, layout: 'fit' or wrapping that Ext.List in a container then use home.add(ListContainer) but nothing works.
I'm very new to ST2.
Greatly appreciate any helps! :) Thank you beforehand.
This is the example code snippet for Ext.List component from the ST2 Docs:
Ext.regModel('Contact', { fields: ['firstName', 'lastName']
});
var store = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',
getGroupString: function(record) {
return record.get('lastName')[0];
},
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Jacky', lastName: 'Nguyen'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'},
{firstName: 'Nigel', lastName: 'White'},
{firstName: 'Don', lastName: 'Griffin'},
{firstName: 'Nico', lastName: 'Ferrero'},
{firstName: 'Nicolas', lastName: 'Belmonte'},
{firstName: 'Jason', lastName: 'Johnston'}
]
});
var list = new Ext.List({
fullscreen: true,
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
store: store
});
I want to create a Ext.Panel component containing that list and other components (I simplified from my app by creating a dummy toolbar named "something").
Here's what I wrote:
Ext.regModel('Contact', { fields: ['firstName', 'lastName']
});
var store = new Ext.data.JsonStore({
model: 'Contact',
sorters: 'lastName',
getGroupString: function(record) {
return record.get('lastName')[0];
},
data: [
{firstName: 'Tommy', lastName: 'Maintz'},
{firstName: 'Rob', lastName: 'Dougan'},
{firstName: 'Ed', lastName: 'Spencer'},
{firstName: 'Jamie', lastName: 'Avins'},
{firstName: 'Aaron', lastName: 'Conran'},
{firstName: 'Dave', lastName: 'Kaneda'},
{firstName: 'Jacky', lastName: 'Nguyen'},
{firstName: 'Abraham', lastName: 'Elias'},
{firstName: 'Jay', lastName: 'Robinson'},
{firstName: 'Nigel', lastName: 'White'},
{firstName: 'Don', lastName: 'Griffin'},
{firstName: 'Nico', lastName: 'Ferrero'},
{firstName: 'Nicolas', lastName: 'Belmonte'},
{firstName: 'Jason', lastName: 'Johnston'}
]
});
var list = new Ext.List({
itemTpl: '<div class="contact">{firstName} <strong>{lastName}</strong></div>',
store: store
});
var home = Ext.create('Ext.Panel',{
fullscreen: true,
scrollable: 'vertical',
items: [{xtype:'toolbar',docked:'top',title:'something'},list]
});
Then the panel with docked toolbar displays normally but the list does not.
Using Chrome element inspector, I see that the list is wrapped in a div with classnames "x-container x-list" with height set to 0. :(
I tried some other ways, like fullscreen: true, layout: 'fit' or wrapping that Ext.List in a container then use home.add(ListContainer) but nothing works.
I'm very new to ST2.
Greatly appreciate any helps! :) Thank you beforehand.