PDA

View Full Version : not loading the data



gigas01
24 Jul 2012, 7:47 PM
1. getting the data



Ext.define('User',{
extend: 'Ext.data.Model',
fields: [
'companyName','activityName','startTime','endTime'
]

}
);

var strUsers = Ext.create('Ext.data.Store', {
model:User,
proxy:{
type: 'ajax',
url : 'http://localhost/ci_extjs_crud/index.php/user/ext_get_all',
method: 'POST'
}
});
strUsers.load();


I checked with the firebug that i get the data well.


{success:true,results:6,rows:[{"companyName":"America Express","activityName":"Expert Conference","startTime":"2010-12-12 15:00:00","endTime":"2010-12-12 16:00:00"},{"companyName":"Bell Lab","activityName":"Lunch","startTime":"2010-12-13 11:30:00","endTime":"2010-12-12 13:00:00"},{"companyName":"America Express","activityName":"Dinner","startTime":"2010-01-01 12:12:12","endTime":"2010-01-02 10:12:12"},{"companyName":"Bell Lab","activityName":"Lunch","startTime":"123-123-","endTime":"123-213"},{"companyName":"America Express","activityName":"Expert Conference","startTime":"10:30 am","endTime":"10:50 pm"},{"companyName":"Bell Lab","activityName":"Lunch","startTime":"10:00","endTime":"11:11"}]}


2. load data to the UI


Ext.create('Ext.grid.Panel',{
title: "Scheduler",
store: strUsers,
height : 200,
width: 400,
columns:[

{
store: strUsers,
mode: 'local',
text: 'company',
dataIndex: 'companyName',
valueField: 'companyName',
displayField: 'companyName'
}
],
renderTo: Ext.getBody()

});




Unfortunately, when i run this, the data isn't loaded ;(

evant
24 Jul 2012, 7:54 PM
How does it know it should read all the data from "rows"?

http://docs.sencha.com/ext-js/4-1/#!/api/Ext.data.reader.Json-cfg-root

There are also examples in the docs.

gigas01
24 Jul 2012, 8:04 PM
Thank you so much!