EasyUI Forum
May 17, 2024, 02:47:58 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: select all in datagrid with scrollview [SOLVED]  (Read 5634 times)
Max Lamda
Newbie
*
Posts: 48


View Profile
« on: December 20, 2017, 08:34:42 AM »

Hi,

is there any solution for the "selectAll" function in a datagrid with scrollview?

Can one load all data somehow unvisible into the grid and do only the rendering of the grid on the scoll-events?


Or can one access the array returned by

datagrid('getSelections') and modify it, that it could contain ALL data? This should be sufficent to make an Ajax-call and get the whole data.

Thanks in advance.

« Last Edit: December 21, 2017, 02:52:42 AM by Max Lamda » Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #1 on: December 20, 2017, 08:39:03 AM »

Should I  try to change


$('#dg').data('datagrid').selectedRows

or

$('#dg').data('datagrid').checkedRows


?



Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #2 on: December 20, 2017, 09:00:16 AM »

I now do the following:


      onSelectAll: function() {
         var dg=$(this);
         var opts=dg.datagrid('options');
         var params={
            sort: opts.sortName,
            order: opts.sortOrder,
            page:1,
            rows: dg.datagrid('getData').total
         };
         $.extend(params,opts.queryParams);
         $.post(opts.url, params, function(data) {
            dg.data('datagrid').selectedRows = data.rows;
            dg.data('datagrid').checkedRows = data.rows;

         },'json');
      },


Seems to work at first glance, but is that reliable?
« Last Edit: December 20, 2017, 09:32:26 AM by Max Lamda » Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #3 on: December 20, 2017, 06:24:20 PM »

Yes, you can set the selected rows by setting the 'selectedRows' manually. Please refer to this example http://code.reloado.com/atopug3/edit#javascript,html,live
Logged
Max Lamda
Newbie
*
Posts: 48


View Profile
« Reply #4 on: December 21, 2017, 02:52:30 AM »

Ok, thanks alot.

I just wasn't sure if I may manipulate this (kind of private) data directly.

My approach should work automatically if server-side reads the query-Params correctly.

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!