toDataSourceRequestString - sort direction

1 Answer 149 Views
Data Query
shieldsjared
Top achievements
Rank 1
shieldsjared asked on 30 Nov 2021, 01:27 PM | edited on 30 Nov 2021, 01:28 PM

Noticed today, while using the toDataSourceRequestString method in @progress/kendo-data-query, that when passing in the SortDescriptor's, although dir? is an optional property, if you leave it null, the SortDescriptor will be excluded from processing and not included in the resultant string. We had to look really closely at the documentation of the property to see that it explicitly tells us that's the case, but seems odd that the dir? is set as optional. Just trying to understand the logic behind this decision... Why is the property optional, if its required?

 

(Ignore the tag, couldn't find an appropriate tag to use...)

1 Answer, 1 is accepted

Sort by
1
Accepted
Svet
Telerik team
answered on 03 Dec 2021, 01:17 PM

Hi Jared,

Thank you for the provided details.

The idea behind the behavior is that the sorting applied to the Grid should be able to be toggled. Or in other words, to go back to the initial state of the Grid data where no sorting has been applied. That behavior can be checked at the example from the following article:

https://www.telerik.com/kendo-angular-ui/components/grid/sorting/

Please check/uncheck the "Toggle unsorting" checkbox in the example and test the sorting functionality on a single column to see the difference in the behavior.

I hope that clears the picture as to why the dir property is optional. Please let me know in case I can provide any further information on this case.

Regards,
Svet
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

shieldsjared
Top achievements
Rank 1
commented on 03 Dec 2021, 02:49 PM

That makes perfect sense! Thank you!
Tags
Data Query
Asked by
shieldsjared
Top achievements
Rank 1
Answers by
Svet
Telerik team
Share this question
or