0

I have a customer renderer for a column in my jqGrid to which jqGrid provides the entire row JSON (rowObject) as the third parameter. I use the rowObject in my renderer to create a hybrid value: status concatenated with row ID. Nice! :)

I also have a custom sorter for the same column. jqGrid provides the custom sorter two values: the current value for status (name => "status" in my colModel) and a hash of all "named" data for the row - one of which is "status", but rowId is NOT included in the hash - apparently because I don't explicitly define a column with name = "rowId".

How do I retrieve rowObject in my custom sorttype function?

There are so few good grid packages for Javascript. I've invested lots of time in jqGrid and I find it difficult to debug problems I encounter.

EDIT:

I found a workaround where I can provide more data to my custom sorttype function. I added more columns to my grid and hide those columns. As before, the second parameter to my sorttype function includes only named data, but naming hidden data makes it available.

I am still confused why I do not receive ALL JSON in my sorttype function.

Upperstage
  • 3,747
  • 8
  • 44
  • 67
  • It's important to know more implementation details: which `datatype` you use? do you use `loadonce: true`? which format have input data (an example with 1-2 rows of data including input `id` values for the rows), `colModel` with definition of all columns which you reference in your question... JavaScript code could clear the most things. – Oleg Jun 10 '14 at 11:34
  • In general custom `sorttype` function contains `rowObject` as the second parameter (see [the answer](http://stackoverflow.com/a/8001822/315935) or [this one](http://stackoverflow.com/a/5296935/315935) for example), but I'm not sure whether it's the only problem which you have. – Oleg Jun 10 '14 at 11:39
  • (I was hoping to read a comment from @Oleg! Your name is all over SO as a jqGrid expert and I welcome your input!) I appear to receive an object (second parameter) into which each NAME'd variable is placed, but what I really want is the JSON provided as the third parameter to my custom renderer. – Upperstage Jun 10 '14 at 12:59
  • The implementation depends really from the implementation details. You need answer on all questions from my first comment. jqGrid allows you a lot of variations in usage. Depend on *how* you use jqGrid and which format of input data you use you can have different solutions of the problem. In some choices your problem could not exist at all. So you really need to post an example of your input data and other information which I asked before. – Oleg Jun 10 '14 at 14:05

0 Answers0