jQuery/jqGrid: populate select boxes with multiple values

Question!

I'm setting up a jqGrid which needs to visualize multiple values in one cell. The input comes from a form where the user can select multiple choices. I am able to display the select box, but not populate it. I have tried to insert an array in the JSON object, but to no success.

This is the model:

index:'ship', editoptions:{multiple:true, value:{1:”FedEx”,2:”InTime”,3:”TNT”,4:”ARAMEX”}}

And here are some variations of the data I've tried populating with:

ship:{[1],[4]}
ship:[[1],[4]]
ship:{value:{1,4}}

…and lots of other variations.

I've searched the jqGrid-forum over and over again but can't seem to find anyone else who has had the same problem. Does anyone know how to fix this?

Best regards, Thomas

By : mandarin


Answers
Oh boy!

I had the answer all the time. It was just as easy as I had hoped it would be.

Here's how it's done:

ship:["FedEx","TNT"]

The reason for why I didn't think it worked is because jqGrid shows the data as "FedEx, TNT", thus making me believe it was only a string. Instead of clicking the cell to see what had happend, I spent hours looking for the answer on the internet. If you'd like to know what happends; jqGrid renders a select list with both elements selected. Simple.

Happy jqGrid'ing!

By : mandarin


This video can help you solving your question :)
By: admin