I have created an OnDemandGrid but noticed that the column sorts weren't working on any column. The arrows are there and the screen refreshes, but it won't sort the columns in asc or desc order. I have even tried specifying for each column but it still doesn't work. Anybody having/had the same issue?
UPDATE: 6.16.15 - After trying sortParam suggestion: Comment below explains. It appears to be doing the right thing... but still won't sort.
UPDATE 6.16.15 - 4:00pm Apparently ANY type of filtering or sort doesn't work well with Django - trying to determine how set filtering where dojo can communicate to Django Rest or vice versa - so far haven't been able to find a setting on either side that works. Not only does column sort not work - creating a search field doesn't work, nor creating a sort button.
This is after changing to the ORDERING_PARAM in DJANGO settings.py to 'SORT'... for all intensive purposes this looks like it should work.
A quick search through the Django Rest Framework documentation reveals that it defaults to expecting an
ordering
query parameter to indicate which field should be sorted. Thedstore/Request
store (inherited byRest
) allows you to indicate the query parameter name that sends sort information, viasortParam
.Additionally, it appears that DRF's OrderingFilter indicates ascending sort with no prefix, and descending sort with
-
.dstore/Request
defaults to expecting+
and-
as prefixes, but these can be overridden viaascendingPrefix
anddescendingPrefix
.So in your case, you'll want to include
sortParam: 'ordering', ascendingPrefix: ''
in the properties passed when you create yourRest
store instance.In general, when you run into store-related issues like this where the grid and backend don't seem to be making ends meet, this is the process you'll have to follow - find out what the server expects, find out what the client-side store implements, and see if it can be tweaked or needs to be customized.
UPDATE 6.17.15 - Changing server side settings to match dojo/dgrid parameters -