0

I have created at a table using jqGrid. In that I have a comboBox. I want the values of the combobox such that It is not used in the previous row.

But, once my first row displayed, then I am unable to change the values of comboBoc in the second row.

Ex: In my combobox, there are three values .. one, two, three. I have selected value "two" in the first row. Then the combo box of the second must have two values: one and three.

I have tried the following code:

$("#listData").setColProp('denomination',
    {editoptions:{value:getDenominationList('addOperation').toString()}});

Here:

getDenominationList('addOperation') will return a String "1:one;3:three"

But this is not working.

halfer
  • 19,824
  • 17
  • 99
  • 186
Gunjan Shah
  • 5,088
  • 16
  • 53
  • 72

1 Answers1

1

I hope I understand correct your question and you want to change the value parameter of editoptions every time depend on the current row id or other grid contain. You can do this inside your custom dataInit event handler (see editoptions):

dataInit: function (elem) {
    var v = $(elem).val();
    var rowId = $(e.target).closest('tr.jqgrow').attr('id');
    var newValue = getDenominationList('addOperation').toString();
    $("#listData").setColProp('denomination', { editoptions: { value:newValue} });
}

The function getDenominationList used in your question don't has the rowid parameter which you probably will need. To simplified it I included in the code above the line which show how the id of the row can be got.

I recommend you to look inside the another answer which I recently answered. It showed how the initial values of value property can be reseted in case of inline editing. It you use form editing you should do this inside of onClose event handler. Moreover in case of form editing you must use recreateForm:true which will force that dataInit event handler will be called not once, but on every row editing.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Sorry, but I am currently in business trip and I am very busy with other projects. So I have no time to prepare new examples. – Oleg Aug 28 '12 at 05:15