jabba
23 Aug 2009, 2:47 AM
Hi everybody,
I have a little problem.
very simple window with ext 3 with grid:
var store = new Ext.data.Store({
mode:'remote',
root:"rows",
totalProperty:'total',
reader: new Ext.data.JsonReader({}, ['ID']),
url: 'ajax.store.kh.php',
fields: [
{name: 'ID', type: 'int'}//,
]
});
store.load();
var grid = new Ext.grid.GridPanel({
store: store,
mode:'remote',
columns: [
{id:'ID',header: "ID", width: 160, sortable: true, dataIndex: 'ID'}//,
],
stripeRows: true,
title:'Klienci',
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: store,
displayInfo: true
})
});
php script generating output is ok:
$o = array(
"success"=>true,
"total"=>"2000", // temporary seted to const value
"rows"=>$arr // data array
);
echo json_encode($o);
answer in firebug is
{"success":true,"total":"2000","rows":[{"ID":1509},{"ID":1497},{"ID":1496},{"ID":1495},
{"ID":1494}]}
I see grid with column ID and with calculated pages but without data.
if I change php to echo only array with data:
echo json_encode($arr);
grid is diplayed ok.
What is wrong ? How to setup paging ?
Best regards
Jabba
I have a little problem.
very simple window with ext 3 with grid:
var store = new Ext.data.Store({
mode:'remote',
root:"rows",
totalProperty:'total',
reader: new Ext.data.JsonReader({}, ['ID']),
url: 'ajax.store.kh.php',
fields: [
{name: 'ID', type: 'int'}//,
]
});
store.load();
var grid = new Ext.grid.GridPanel({
store: store,
mode:'remote',
columns: [
{id:'ID',header: "ID", width: 160, sortable: true, dataIndex: 'ID'}//,
],
stripeRows: true,
title:'Klienci',
bbar: new Ext.PagingToolbar({
pageSize: 5,
store: store,
displayInfo: true
})
});
php script generating output is ok:
$o = array(
"success"=>true,
"total"=>"2000", // temporary seted to const value
"rows"=>$arr // data array
);
echo json_encode($o);
answer in firebug is
{"success":true,"total":"2000","rows":[{"ID":1509},{"ID":1497},{"ID":1496},{"ID":1495},
{"ID":1494}]}
I see grid with column ID and with calculated pages but without data.
if I change php to echo only array with data:
echo json_encode($arr);
grid is diplayed ok.
What is wrong ? How to setup paging ?
Best regards
Jabba