EasyUI Forum
April 19, 2024, 05:18:29 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: bufferview pagination  (Read 7848 times)
lloyd
Newbie
*
Posts: 29


View Profile Email
« on: November 11, 2015, 02:56:28 PM »

Because I have had to change my code to use datagrid bufferview due to better performance with bufferview. Checkrows no longer works with bufferview (see code below). If I remove bufferview checkrows works.

How to I fix this?

Code:
        dg.datagrid({
            onCheckAll: function() {
                var allRows = $(this).datagrid('getAllRows');
                var state = $(this).data('datagrid');
               
                state.checkedRows = allRows;
            },
            onUncheckAll: function() {
                var state = $(this).data('datagrid');
                state.checkedRows = [];
            }
        }).datagrid('clientPaging');
Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #1 on: November 11, 2015, 08:08:59 PM »

The bufferview is used to load buffered data without pagination. You don't need to call 'clientPaging'.
Code:
$('#tt').datagrid({
    data: rows,
    idField: 'inv',
    view: bufferview,
    selectOnCheck: false,
    onLoadSuccess: function(data){
        var dg = $(this);
        for(var i=0; i<data.rows.length; i++){
            var row = data.rows[i];
            if ($.inArray(row, dg.datagrid('getChecked')) >= 0){
                var index = dg.datagrid('getRowIndex', row);
                dg.datagrid('checkRow', index);
            }
        }
    },
    onCheckAll: function(){
        var state = $(this).data('datagrid');
        state.checkedRows = $.extend([], state.data.rows);
    },
    onUnCheckAll: function(){
        var state = $(this).data('datagrid');
        state.checkedRows = [];
    },
    onCheck: function(index,row){
        var state = $(this).data('datagrid');
        if (state.checkedRows.length == state.data.rows.length){
            state.dc.header1.add(state.dc.header2).find('input[type=checkbox]')._propAttr('checked', true);
        }
    }
})
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #2 on: April 03, 2017, 06:46:03 AM »

Hello
I try to use onCheckAll event on data-grid with scrollview:
Code:
  var state = $(this).data('datagrid');
  state.checkedRows = $.extend([], state.data.rows);
but it does not work - checked is only first page rows.

I also try this
Code:
  var data = $('#dg').datagrid('getData');
  var rows = data.firstRows;
  var state = $(this).data('datagrid');
  state.checkedRows = rows;
and it does not work, too.
How to check rows on all pages, when using scrollview, please?
Thank you.

Logged
jarry
Administrator
Hero Member
*****
Posts: 2262


View Profile Email
« Reply #3 on: April 04, 2017, 07:54:39 AM »

Please look at this example http://code.reloado.com/umotof3/edit#preview
Logged
Pierre
Sr. Member
****
Posts: 439


View Profile Email
« Reply #4 on: April 05, 2017, 12:46:36 AM »

Jarry it works awesome, thank you so much for your help.
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!