Hi, guys. I am newby in ExtJs and front-end programming is not my strong side, so I need some help in my project.
I have few questions about Grid and Proxy. Here is Example of my Grid:
Code:
var storeMain = new Ext.data.JsonStore({
root: 'messages',
remoteSort: true,
fields: [
{name: 'number'},
{name: 'sn' },
{name: 'dt'},
{name: 'text'},
{name: 'adt'},
{name: 'texta'}
],
proxy: new Ext.data.ScriptTagProxy({
url: 'controller.php?action='+myfunc()
})
});
// create the Grid
var grid = new Ext.grid.GridPanel({
store: storeMain,
columns: [
{header: "Телефон", width: 70, dataIndex: 'number'},
{header: "Номер", width: 70, dataIndex: 'sn'},
{header: "Получено", width: 70, dataIndex: 'dt'},
{header: "Смс от абонента", width: 250, dataIndex: 'text'},
{header: "Получено", width: 70, dataIndex: 'adt'},
{header: "Смс абоненту", width: 320, dataIndex: 'atext'}
],
stripeRows: true,
height:555,
title:'Сообщения',
plugins: new Ext.ux.PanelResizer({
minHeight: 100
}),
bbar: new Ext.PagingToolbar({
pageSize: 100,
store: storeMain,
displayInfo: true,
beforePageText: 'Страница',
afterPageText : 'из',
displayMsg: 'Отображаемые сообщения {0} - {1} из {2}',
emptyMsg: "Нет сообщений для отображения",
plugins: new Ext.ux.ProgressBarPager()
})
});
grid.render('content');
storeMain.load({params:{start:0, limit:100}});
When I refresh page, this request is going to server:
Code:
http://localhost/statistic/controller.php?action=getMessages&start=0&limit=100&_dc=1303225020100&callback=stcCallback1001
And response from server:
Code:
{"totalCount":"2","messages":[{"number":"36333","sn":"776","adt":"2011-04-18 13:41:07","dt":"2011-04-18 13:41:02","text":"?","atext":"sometext"},{"number":"3801","sn":"51","adt":"2011-04-18 13:40:04","dt":"2011-04-18 13:40:02","text":"555","atext":"another text"}]}
But it doesn't work, Grid is empty and preloader image on paging bar is visible.
Questions:
1. Why it doesn't work? I read documents and saw examples paging grid, so I tried do all like in example.
2. My JS and PHP are situated on the same domain, maybe it will be easier to use another proxy object, not ScriptTagProxy. Which one? POST method is better for me than GET.
3. When some button is pressed, I need to change datas in this Grid with paging, how can I do that, when I am using proxy?
Thanks for your help/advices and sorry for my English.