PDA

View Full Version : How to use sencha touch traversal store?



citynong
7 Mar 2011, 6:33 PM
How to use sencha touch traversal store?
Tried several times, but not succeed.
Someone wants to tell me? thank you

Ext.regModel('user', {
fields: ['name','password'],
proxy: {
type: 'ajax',
url : 'jsp/items.jsp'
}
});
var store = new Ext.data.Store({
model: 'user',
autoLoad: true
});
store.each('user',function(record) {
Ext.Msg.alert('Info',record.get('name'));
});

8 Mar 2011, 4:02 AM
xt.regModel('user', {
fields: ['name','password'],
proxy: {
type: 'ajax',
url : 'jsp/items.jsp'
}
});
var store = new Ext.data.Store({
model: 'user',
autoLoad: true,
listeners : {
load : function() {
store.data.each(function(record) {
console.info(record.get('name'));
});
}
}
});


Your problems:
1) You are trying to access data from the store before it has actually finished the round trip.
2) Don't do a Msg.alert on multiple items. You'll only see the last.
3) *do* use an event listener, such as load to manipulate your store after it has been loaded.

citynong
8 Mar 2011, 4:27 AM
thank you very much!
expect sench touch in action