$ Link = mysql_pconnect ("test-db.vinylfox.com", "test", "testuser") or die ("cocould not connect"); mysql_select_db ("test ") or die ("cocould not select database"); $ SQL _count = "select ID, name, title, hire_date, active from random_employee_data"; $ SQL = $ SQL _count. "limit ". gird dataThe data on each page of the grid must be divided by the server side.
In this example, the server language is Php and the database is MySQL, which is used to export random data. The following script is used to obtain the data we want and the data is split into pages. The paging parameters are determined by the limit and start variables passed in by the page toolbar.
___FCKpd___0
Because the development environment in each background is different, the server code here is not detailed.
How to Create a grid with paginationIn this exampleScripttagproxyThe reason is that the sample code and the server code are not on the same server (: "cross-origin"), and in most cases, the data is obtained on the same server, you can use httpproxy directly.
The only difference between datastore and datastore is that you need to setTotalproertyAttribute. In this example, we calculate the value of "Total" from the script on the server to tell datastore how many records there are in total. This indicates the number of all records.
var ds = new Ext.data.Store({ proxy: new Ext.data.ScriptTagProxy({ url: 'http://www.vinylfox.com/yui-ext/examples/grid-paging/grid-paging-data.php' }), reader: new Ext.data.JsonReader({ root: 'results', totalProperty: 'total', id: 'id' }, [ {name: 'employee_name', mapping: 'name'}, {name: 'job_title', mapping: 'title'}, {name: 'hire_date', mapping: 'hire_date', type: 'date', dateFormat: 'm-d-Y'}, {name: 'is_active', mapping: 'active'} ]) });
ToolbarAdd a tab bar to the grid panel. -- almost done.
var gridFoot = grid.getView().getFooterPanel(true); var paging = new Ext.PagingToolbar(gridFoot, ds, { pageSize: 25, displayInfo: true, displayMsg: 'Displaying results {0} - {1} of {2}', emptyMsg: "No results to display" });
FinallyStartAndLimitParameters to initialize data.
ds.load({params:{start:0, limit:25}});
A lot of time is spent on how to generate data in the background to work with the grid. Once these jobs are OK, paging the grid is no longer a problem.
Get ['start']. ",".
Gird data
The data on each page of the grid must be divided by the server side.
In this example, the server language is Php and the database is MySQL, which is used to export random data. The following script is used to obtain the data we want and the data is split into pages. The paging parameters are determined by the limit and start variables passed in by the page toolbar.
___FCKpd___0
Because the development environment in each background is different, the server code here is not detailed.
How to Create a grid with paginationIn this exampleScripttagproxyThe reason is that the sample code and the server code are not on the same server (: "cross-origin"), and in most cases, the data is obtained on the same server, you can use httpproxy directly.
The only difference between datastore and datastore is that you need to setTotalproertyAttribute. In this example, we calculate the value of "Total" from the script on the server to tell datastore how many records there are in total. This indicates the number of all records.
___FCKpd___1
ToolbarAdd a tab bar to the grid panel. -- almost done.
___FCKpd___2
FinallyStartAndLimitParameters to initialize data.
___FCKpd___3
A lot of time is spent on how to generate data in the background to work with the grid. Once these jobs are OK, paging the grid is no longer a problem.
Get ['limit'];
$ Rs_count = mysql_query ($ SQL _count );
$ Rows = mysql_num_rows ($ rs_count );
$ Rs = mysql_query ($ SQL );
While ($ OBJ = mysql_fetch_object ($ RS ))
{
$ Arr [] = $ OBJ;
}
Echo
Gird data
The data on each page of the grid must be divided by the server side.
In this example, the server language is Php and the database is MySQL, which is used to export random data. The following script is used to obtain the data we want and the data is split into pages. The paging parameters are determined by the limit and start variables passed in by the page toolbar.
___FCKpd___0
Because the development environment in each background is different, the server code here is not detailed.
How to Create a grid with paginationIn this exampleScripttagproxyThe reason is that the sample code and the server code are not on the same server (: "cross-origin"), and in most cases, the data is obtained on the same server, you can use httpproxy directly.
The only difference between datastore and datastore is that you need to setTotalproertyAttribute. In this example, we calculate the value of "Total" from the script on the server to tell datastore how many records there are in total. This indicates the number of all records.
___FCKpd___1
ToolbarAdd a tab bar to the grid panel. -- almost done.
___FCKpd___2
FinallyStartAndLimitParameters to initialize data.
___FCKpd___3
A lot of time is spent on how to generate data in the background to work with the grid. Once these jobs are OK, paging the grid is no longer a problem.
Because the development environment in each background is different, the server code here is not detailed.
How to Create a grid with paginationAdd a tab bar to the grid panel. -- almost done.
A lot of time is spent on how to generate data in the background to work with the grid. Once these jobs are OK, paging the grid is no longer a problem.