I have made a gridx grid that uses a JsonRest Memory store from the dojo framework http://dojotoolkit.org/reference-guide/1.10/dojo/store/JsonRest.html
the issue is I do not know how to pull out the sort parameter from the query string.
The url being formatted from the JsonRest call is
/admin/sales?sort(+DealershipName)
using the following statement gives me a null error
String sort = Request.QueryString["sort"].ToString();
Looking at the debugger I see the following (I need more rep to post images :( )
ok I can see that the following variables hold this value.
Request.QueryString = {sort(+DealershipName)}
type : System.Collections.Specialized.NameValueCollection
{System.Web.HttpValueCollection}
but the array is null.
I'm thinking I can do two thing. Parse the string myself or overload the dojo JsonRest Memory store. Parsing the string seems easier but if anyone has any idea or knows any libraries that can help me out. I would greatly appreciate it.
dojo/store/JsonRest
has a sortParam
property that you can set to the name of a standard query parameter to use instead of sort(...)
(which it uses by default to avoid colliding with any standard query parameters).
For example, adding sortParam: 'sort'
to the properties passed to the JsonRest
constructor will result in the query string including sort=+DealershipName
instead.
http://dojotoolkit.org/reference-guide/1.10/dojo/store/JsonRest.html#sorting
If the +
also presents a problem, you can also override ascendingPrefix
to be an empty string (''
). Note that descending sort will still be indicated by a leading -
(controllable via descendingPrefix
).