Empty order_by field from jqgrid causes failure in tastypie api -
i'm using jqgrid access tastypie api. i've changed sidx "order_by" match default tastypie api.
jqgrid passes order_by (formerly sidx) parameter regardless of whether it's ordering or not. if not sorting, passes empty string sort critiera. tastypie freaks out @ empty string saying "there no field named '' "
the way see it, there's 2 options solve:
- have jqgrid stop sending order_by param unless needs to
- have tastypie ignore empty order_by string...
any suggestions on how either of 2 things?
i not sure, full understand problem. first of rename sidx
order_by
1 can use
prmnames: {sort: "order_by"}
if never sidx
or order_by
send can use
prmnames: {sort: null}
you can implement scenarios in changing prmnames.sort
dynamically. can use jqgrid callbacks or events.
one more way control list of parameters sent server serializegriddata
callback. example
serializegriddata: function (postdata) { var mypostdata = $.extend({}, postdata); // make copy of input parameter if (mypostdata.sidx.length === 0) { // or mypostdata.order_by.length delete mypostdata.sidx; } return mypostdata; }
see the answer example.
Comments
Post a Comment