atze
19 Jan 2010, 11:03 AM
Hi,
I dont now how to property return data from symfony function and how to use this in store.
/**
* Test
*
* @extdirect-enable
* @extdirect-len 0
*
*/
public function executeTest()
{
$data = array (
array ('3m Co',71.72),
array ('Alcoa Inc',29.01),
array ('Wal-Mart Stores, Inc.',45.45)
);
$this->result = array('resultArray' => $data, 'totalCount' => count($data));
return sfView::SUCCESS;
}Response - date return as object:
{"type":"rpc","tid":2,"action":"portal","method":"test","result":{"resultArray":[["3m Co",71.72],["Alcoa Inc",29.01],["Wal-Mart Stores, Inc.",45.45]],"totalCount":3}}Store:
var store = new Ext.data.DirectStore({
directFn: myApp.portal.test,
root: 'resultArray', // ???
totalProperty: 'totalCount', // ???
fields: [
{name: 'company'},
{name: 'price', type: 'float'}
]
});
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'company',header: 'Company', dataIndex: 'company'},
{header: 'Price', dataIndex: 'price'}
],
height: 350,
width: 600,
});Grid is empty. Only rows no data. What is wrong?
I dont now how to property return data from symfony function and how to use this in store.
/**
* Test
*
* @extdirect-enable
* @extdirect-len 0
*
*/
public function executeTest()
{
$data = array (
array ('3m Co',71.72),
array ('Alcoa Inc',29.01),
array ('Wal-Mart Stores, Inc.',45.45)
);
$this->result = array('resultArray' => $data, 'totalCount' => count($data));
return sfView::SUCCESS;
}Response - date return as object:
{"type":"rpc","tid":2,"action":"portal","method":"test","result":{"resultArray":[["3m Co",71.72],["Alcoa Inc",29.01],["Wal-Mart Stores, Inc.",45.45]],"totalCount":3}}Store:
var store = new Ext.data.DirectStore({
directFn: myApp.portal.test,
root: 'resultArray', // ???
totalProperty: 'totalCount', // ???
fields: [
{name: 'company'},
{name: 'price', type: 'float'}
]
});
var grid = new Ext.grid.GridPanel({
store: store,
columns: [
{id:'company',header: 'Company', dataIndex: 'company'},
{header: 'Price', dataIndex: 'price'}
],
height: 350,
width: 600,
});Grid is empty. Only rows no data. What is wrong?