This is a migrated thread and some comments may be shown as answers.

Spreadsheet with Remote data & Sorting

10 Answers 245 Views
Spreadsheet
This is a migrated thread and some comments may be shown as answers.
Marc
Top achievements
Rank 1
Marc asked on 28 Feb 2017, 02:54 PM

I have a spreadsheet, with a datasource which retches remote data. When I sort the spreadsheet and edit row 2 (which was originally row 100), the datsource thinks that I have edited row 100. Is there a solution to this?

Marc

10 Answers, 1 is accepted

Sort by
0
Veselin Tsvetanov
Telerik team
answered on 02 Mar 2017, 08:29 AM
Hello Marc,

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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 02 Mar 2017, 08:36 AM

Hi Veselin,

Are there any plans to implement this? I see it is quite a large bug.

Marc

0
Marc
Top achievements
Rank 1
answered on 03 Mar 2017, 08:34 AM

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?

0
Veselin Tsvetanov
Telerik team
answered on 06 Mar 2017, 07:45 AM
Hi Marc,
 
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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 06 Mar 2017, 07:48 AM

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

0
Marc
Top achievements
Rank 1
answered on 06 Mar 2017, 11:09 AM

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

0
Veselin Tsvetanov
Telerik team
answered on 08 Mar 2017, 07:11 AM
Hello 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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 08 Mar 2017, 07:33 AM

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.

 

 

0
Veselin Tsvetanov
Telerik team
answered on 10 Mar 2017, 08:15 AM
Hi 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
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Marc
Top achievements
Rank 1
answered on 10 Mar 2017, 08:33 AM

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;
}

Tags
Spreadsheet
Asked by
Marc
Top achievements
Rank 1
Answers by
Veselin Tsvetanov
Telerik team
Marc
Top achievements
Rank 1
Share this question
or