jqgrid not displaying option text after save

211 views Asked by At

I have 3 editable dropdown columns in jqgrid, 2 dropdowns are populated dynamically onedit. Because values of those dropdown depends on selection of first. Grid row becomes editable as soon as row is selected & its configured to update the values after user clicks enter. Issue is after saving row, dropdown column 3 & 4 are not showing selected text in the grid. Cells are empty.

This is how both columns are setup

            {
                name: "FirstDrop", index: "FirstDrop", width: 180, align: "left", editable: true, formatter: 'select', edittype: "select", editoptions: {
                    value:"0:select;1:first,2:second", valuesToSelect: "0"
                    , dataEvents: [
                        {
                            type: 'change',
                            fn: function (e) {
                                 //function that reload SecDrop based on value selected in this
                            }
                        }
                    ]
                }
            },
                {
                    name: "SecDrop", index: "SecDrop", width: 180, align: "left", editable: true, edittype:'select', formatter: 'select', editoptions: {
                        dataInit: function (elem) {
                           // function that appends options to "elem"
                           //$(elem).val(""); Select initial value here
                        }
                    }
                }

So now, when I change selection in first dropdown, second dropdown is reloaded with new value. After selecting new value in second dropdown, upon saving, the column is empty. Instead it should show text value of selected option.

I get the value of the second column when I loop through all rows.

Not sure what I am missing here. Any suggestions, is something missing, can same result be achieved using custom format option.

1

There are 1 answers

0
Jay On

Not sure if this is a known issue in jqgrid v.4.7 But I figured out a hack, now handling the aftersave function to get the value of selected option and retrieving its corresponding text from the source json & assigning it to cell.