EasyUI Forum
February 06, 2026, 09:16:49 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: pagination page & rows rename [solved]  (Read 12241 times)
devnull
Sr. Member
****
Posts: 431


View Profile
« 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.



« Last Edit: December 08, 2016, 08:50:29 PM by devnull » Logged

-- Licensed User --
jarry
Administrator
Hero Member
*****
Posts: 2306


View Profile Email
« Reply #1 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;
}
});
Logged
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #2 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.

Logged

-- Licensed User --
devnull
Sr. Member
****
Posts: 431


View Profile
« Reply #3 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);
      }
Logged

-- Licensed User --
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!