EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: devnull on July 06, 2016, 04:18:45 PM



Title: pagination page & rows rename [solved]
Post by: devnull on July 06, 2016, 04:18:45 PM
Is it possible to rename the rows and page variables sent with a query to _page and _rows as in my application any field that does not start with an underscore is treated as a database field name, wheras fields that start with an underscore are treated as control variables.





Title: Re: pagination page & rows rename
Post by: jarry on July 06, 2016, 06:32:19 PM
You can not change the 'page' and 'rows' parameter name, but you can construct new request parameters.
Code:
$('#dg').datagrid({
onBeforeLoad: function(param){
param._page = param.page;
param._rows = param.rows;
}
});


Title: Re: pagination page & rows rename
Post by: devnull on July 07, 2016, 08:33:30 PM
Thanks Jarry

but unfortunately that does not solve my problem as I have a global function at the backend that automatically generates the SQL statements based on the form fields submitted, and field that does not start with an underscore is considered to be a valid database field and will get added to the sql statement.



Title: Re: pagination page & rows rename [solved]
Post by: devnull on December 08, 2016, 08:50:12 PM
I know this is an old post, but for other people's info I thought I would show a work-around.

Use the datagrid onBeforeLoad() to add / delete the hard-coded names, this is messy but it works.

Code:
      onBeforeLoad: function(param){
        param._page = param.page; param._rows = param.rows || 25;
        delete(param.page); delete(param.rows);
      }