EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: rezzonico on September 30, 2016, 12:51:05 AM



Title: datagrid + getColumnFields + getFilterRules
Post by: rezzonico on September 30, 2016, 12:51:05 AM
Hi all,

I have a datagrid with enableFilter e pagination.
All works as expected.

I am searching for a solution in order to print all the selected records and not only the records on the current page. Therefore reading the content of the displayed records, with $(this).datagrid('getRows'), is not a solution.

What I am writing is a javascript that call a program (with ajax) and pass the "datagrid url" and all the "filter rules".
The called program will then do a "SELECT" and send all records to the server printer spooler.

I am able the read the datagrid url with $(this).datagrid('options').url
I am able to read the column fields with $(this).datagrid('getColumnFields')
I am able to read the filter values with $(this).datagrid('getFilterRules')

... and pass these parameters to the program.

Is this the correct approach ?
Perhaps there is a quick solution ?

Regards
Miche


Title: Re: datagrid + getColumnFields + getFilterRules
Post by: stworthy on October 01, 2016, 09:39:02 PM
That is the way to retrieve rows in server side. The code below shows how to retrieve these rows in client side.
Code:
function getFilteredRows(dg){
    var opts = dg.datagrid('options');
    var src = dg.data('datagrid').filterSource;
    var data = opts.filterMatcher.call(dg[0], src);
    return data;
}


Title: Re: datagrid + getColumnFields + getFilterRules
Post by: rezzonico on October 04, 2016, 12:58:18 AM
Thanks a lot !

Regards
Miche