EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Max Lamda on December 20, 2017, 08:34:42 AM



Title: select all in datagrid with scrollview [SOLVED]
Post by: Max Lamda 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.



Title: Re: select all in datagrid with scrollview
Post by: Max Lamda on December 20, 2017, 08:39:03 AM
Should I  try to change


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

or

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


?





Title: Re: select all in datagrid with scrollview
Post by: Max Lamda 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?


Title: Re: select all in datagrid with scrollview
Post by: stworthy 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


Title: Re: select all in datagrid with scrollview
Post by: Max Lamda 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.