EasyUI Forum
May 01, 2024, 04:18:33 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Poll
Question: The Attribute pageNumber of datagrid is invalid when it is greater than 2.
pageNumber is bad. - 0 (0%)
pageSize is ok. - 0 (0%)
Total Voters: 0

Pages: [1]
  Print  
Author Topic: Datagrid can't display pageNumber where it's greater than 2.  (Read 19718 times)
java
Newbie
*
Posts: 4


View Profile
« on: August 04, 2012, 07:56:46 PM »

For example:

Step1 : Download jquery-easyui-1.3.zip and zip to F:\jquery-easyui-1.3.
Step2 : Open F:\jquery-easyui-1.3\demo\datagrid.html in notepad and edit it as below( red lines is new added):


   $(function(){
         $('#test').datagrid({
            title:'My DataGrid',
            iconCls:'icon-save',
            width:700,
            height:350,
            nowrap: true,
            autoRowHeight: false,
            striped: true,
            collapsible:true,
            url:'datagrid_data.json',
            sortName: 'code',
            sortOrder: 'desc',
            remoteSort: false,
            idField:'code',
            pageNumber:3,
            pageSize:20,

            frozenColumns:[[
                   {field:'ck',checkbox:true},
                   {title:'Code',field:'code',width:80,sortable:true}
            ]],
              .........................


Step3 : Open F:\jquery-easyui-1.3\demo\datagrid.html in IE9.

I find pageSize is OK, but pageNumber is ineffective.

Please fix it as soon as possible...........
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: August 05, 2012, 01:10:13 AM »

Override the datagrid loader to fix this bug:
Code:
$.extend($.fn.datagrid.defaults, {
loader: function(param, success, error){
var opts = $(this).data('datagrid').options;
var pager = $(this).datagrid('getPager');
if (pager.length && pager.pagination('options').total == 1){
pager.pagination('refresh',{
pageNumber:opts.pageNumber,
total: opts.pageNumber*opts.pageSize
});
}
if (!opts.url) return false;
$.ajax({
type: opts.method,
url: opts.url,
data: param,
dataType: 'json',
success: function(data){
success(data);
},
error: function(){
error.apply(this, arguments);
}
});
}
})

Another way to fix this bug is to download the pagination plugin from http://www.jeasyui.com/easyui/plugins/jquery.pagination.js.
Logged
java
Newbie
*
Posts: 4


View Profile
« Reply #2 on: August 05, 2012, 08:26:00 PM »

Thank you. 

 It's ok that override the datagrid loader by first way,

But download http://www.jeasyui.com/easyui/plugins/jquery.pagination.js to overwrite old file is no effective.
Logged
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!