PDA

View Full Version : Paging in Ext Grid



fahadmalik
16 Feb 2015, 1:54 AM
Hi I am using Ext Js version 4.1.8 and I want to add paging on my extjs grid.

I have been using


Ext.create('Ext.data.Store', {
model: 'List',
proxy:{
type: 'ajax',
api:{
read:'getJson.php',
},
extraParams:{
PRKEY : selectedProjId
},
},
reader:{
type: 'json',
root: 'data',
}
});

That is working fine, but if I change my json format in my php file and change the root type to someother string like 'users' I do not see any data

Here is my json creation code in getJson.php


//in a loop
$aNode = array(
"Name" => "My Name",
"ID" => "123");
array_push($nodeArr, $aNode);
//end of loop

$json = new Services_JSON;
$jsonResult = array(
'success' => "true",
'users' => $nodeArr
);
echo json_encode($jsonResult );

Please help so I can add totalProperty in reader of my store and perform paging

steffenk
16 Feb 2015, 8:05 AM
just change root in your model to users and it will work again.
For paging you need to provide the total number of records as well (represents totalProperty in store) and the extra params - add pagingtoolbar to your grid and watch the params sended by the grid.