The documentation for sortMultiple is a bit lacking: http://help.infragistics.com/jQuery/2012.1/ui.iggridsorting
I'm assuming it allows for sorting multiple columns, but the example doesn't give any sort of indication of how that's done and there's no documentation other than the sample line:
$(
".selector"
).igGridSorting(
"sortMultiple"
);
What I need to do is similar to what this user needed to do: http://es.infragistics.com/community/forums/p/72571/367397.aspx#367397The difference is I need to retrieve all the data filtered and sorted as the user has it on the web page (this is part of an export function).By the way, this seems like very obvious functionality that ought to be added to the grids at some point. I just throw this out there in case you're taking suggestions for functionality. I'm sure I'm not the first person who's wanted to retrieve a copy of all the data (unpaged) as the grid is currently configured by the user. That is, using the sort and filter options the user currently has...Anyway, I need to know how to apply the currently set sort to the filtereddatsource from the above referenced forum post.
Thanks.
I was actually hoping for a more generic solution that could be mostly implemented in javascript (from extraction of the data to generation of the PDF and Excel), but after digging a bit deeper that doesn't appear to be achievable in the way I would have hoped. I can see how that complicates the usefulness of the kind of export I was thinking of.
Thanks for the additional info.
Hi Pete,Actually exporting unpaged grid data while paging is enabled is a rather uncommon feature - this is why exports are usually handled by a server side code (it has access to all of the grid data and possible view - ignoring or taking into regard thing such as pagination and filtering and sorting conditions).I looked over the Google query you mentioned and some of the results actually match some of the samples we already have in the Samples Browser: exporting the igGrid data to Excel, XPS & PDF and WinWord. Client and server-side features can prove challenging to deal with when it comes to retrieving the desired data view.Thus, thank you for understanding and willing to look for solutions! :)We're here to help out with whatever we can.Cheers!
Borislav,
Thanks for the detailed answer and sample.
I'm surprised this isn't a commonly desired feature. If one does a google search on "grid export data" you'll see a HUGE number of pages devoted to explanations of how to code data exports from grids (google estimates 43 million results to the search). And while I'm sure there are a number of irrelevant returns, going through 15-20 pages of results you'll see a almost all relevant results on each page (many of them regarding how to export data from various control vendors' grids).
But I'm sure you're far more familiar with what your users are asking for than I am. I don't mind digging into the internals a bit. I just went on the assumption, based on how Google responded...
Thanks again for the detailed answer.
Pete
Hi Pete,First off, let me apologize for the lack of a description on the sortMultiple method. The method is exposed as public due to implementation reasons - it's used by the multiple sorting's modal dialog if I'm not mistaken. This is why it doesn't accept any input parameters (because they're read internally).
As for applying the multiple sorting in a single API call, I would recommend doing so like this:
(this will also update the grid's UI so no further steps are needed).However, if you want to access the grid's data when it's bound to local (client-side) data and paging, sorting and filtering are all local (client-side), then I have the solution just for you.It's basically the same as in the one from my reply on the forum thread you quoted but with one trick to it:
//Filter the grid with a good enough condition so that we can have at least one record on the 2nd page $('#grid1').igGridFiltering("filter", [{fieldName: "Name",cond:"doesNotContain",expr:"Silverlight"}]); $("#grid1").data("igGrid").dataSource.settings.sorting.expressions = [ { fieldName: "IsPostponed", dir: "desc"}, { fieldName: "EndDate", dir: "asc"}]; $('#grid1').igGridSorting("sortMultiple"); var filteredSortedDataSource = $.extend(true, {}, $("#grid1").data("igGrid").dataSource); // we need to disable the paging feature so that the dataView() can represent only the filtered data. filteredSortedDataSource.settings.paging.enabled = false; // we need to make sure that sorting is applied to the filtered data filteredSortedDataSource.settings.sorting.applyToAllData = false; // Filter the copy of the igGrid's internal igDataSource in order to receive the desired data view filteredSortedDataSource = filteredSortedDataSource.filter($("#grid1").data("igGrid").dataSource.settings.filtering.expressions); filteredSortedDataSource = filteredSortedDataSource.sort($("#grid1").data("igGrid").dataSource.settings.sorting.expressions); var filteredSortedDataWithoutPaging = filteredSortedDataSource.dataView();
The trick is in disabling the igDataSource sorting's applyToAllData option - then you can properly sort only the filtered data.As usual I'm attaching a running HTML sample page where you can see my suggestion in effect.If you have any other problems or questions, don't hesitate to let us know.PS: Sorry about this requiring knowledge of the igDataSource, but when compared with the requirements we have for the igGrid and igDataSource, this isn't such a high priority scenario for us to provide an easy solution to.By the way, there really aren't that many people (to the best of my knowledge, based on the forum and StackOverflow activity) that need to handle this scenario.PPS: If you wish for us to devote some time and effort in order to provide an out-of-the-box solution, please feel free to post a new feature idea in the corresponding page under your account.Cheers,Bobby