10 Answers, 1 is accepted
Currently the Spreadsheet widget does not support sorting or filtering, while editing data of a Sheet bound to remote DataSource. The reason for that is the fact, that editing of items relies on their ordered index on the client, which should match the index on the server.
Regards,
Veselin Tsvetanov
Telerik by Progress
Hi Veselin,
Are there any plans to implement this? I see it is quite a large bug.
Marc
Hi Veseline,
I'm confused why this isn't implemented. Could you not just (in the spreadsheet sort & filter events) use the .sort and .filter method of the datasource to keep them synchronised?
The sort and filter functionality of a databound Spreadsheet Sheet is currently not supported because of the internal implementation decisions on the Spreadsheet widget. Note, that it would require the sort and filter state to be passed from the client to the server and to be applied to the DataSource server-side. Also, its implementation is not included in our near future plans.
In case, that you think such functionality would add considerable value to the Spreadsheet widget, I would suggest you to post a feature request in our Feedback portal. Based on the support it receives from the community, we will make our decision whether to proceed with its implementation or not.
Regards,
Veselin Tsvetanov
Telerik by Progress
Hi Veselin,
I do not understand what you're saying. In my js file (It's an AngularJS controller), I have a datasource object and a spreadsheet component. When I change the sort or filter inside the spreadsheet, couldn't the sort/fitler events of the spreadsheet be used, to fire a .sort or .filter method on the datasource, to ensure the correct row is updated in the datasource client side?
Thanks
Marc
Is there an event which is fired (which I can access) when the spreadsheet is sorted? Or is there a way to disable the sort options inside the filtermenu object of the spreadsheet?
Thanks,
Marc
Answering to your questions:
- The Spreasdheet widget does not expose sort / filter events, that could be handled. In addition, the DataSource of the Spreadsheet could be configured with remote source (transport actions as in our demo). In such scenario, the information of how the data is currently sorted / filtered should be sent to server along with the information about the deleted / inserted / updated entry. The data from the database should be sorted and filtered on the server and the appropriate item should be modified / deleted or created. This synchronization of the filtering / sorting of data between the client and the server is currently not supported by the Spreadsheet and the DataSource objects;
- As I mentioned, there is no event that would be fired, when the data in the Sheet is sorted. However, you could simply remove the filter tool from the toolbar by manually specifying the included tools in the Home tab. Here you will find a simple Dojo sample, demonstrating the above.
Alternatively, if you need to hide only the sort section in the filtering menu, you could do that by using CSS:
.k-spreadsheet-filter-menu li[data-command=
"sort"
] {
display
:
none
;
}
Regards,
Veselin Tsvetanov
Telerik by Progress
Hi Vaselin,
I understand the issues here. The problem I have is that I am not using the datasource for the webservice URL's. I have a webservice which returns a value. The value is held inside $scope.myresults. I then use the datasource read function as below:
transport: {
read: function (options) {
options.success($scope.myresults);
}
}
I do not show the Home tab, so I cannot remove the filter menu. Our users want to be able to filter & sort, but this means that to save the data we must use the spreadsheet.range method, and manually find changed records, and manually create objects to pass to the back end.
Thanks for the information about hiding the sort options.
Marc.
I am afraid, that at the current moment the combination of DataSource binding + sorting / filtering remains unsupported by the widget. Therefor, to manually alter the changed values remains the only option in this scenario.
Regards,
Veselin Tsvetanov
Telerik by Progress
No problem - thanks for all the help!
The solution to hide the sort menu did not work, I have fixed it using the below, just for anyone else who may need it:
.k-spreadsheet-filter-menu ul li[data-command="sort"] {
display: none;
}