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:

  1. have jqgrid stop sending order_by param unless needs to
  2. 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

Popular posts from this blog

javascript - backbone.js Collection.add() doesn't `construct` (`initialize`) an object -

php - Get uncommon values from two or more arrays -

Adding duplicate array rows in Php -