0

I have a jqGrid which when a row is selected, a jQuery UI modal form will popup which I would like to contain the data for the selected row. The form would ideally contain the row data, a confirm button and a cancel button. Is this possible? I have tried to find an answer and haven't had any luck as of yet. The data will be carried through to another form where the values will be editable.

Thanks in advance.

moikey
  • 353
  • 3
  • 7
  • 16

1 Answers1

3

I think you can use the following

onSelectRow: function (id) {
    $(this).jqGrid('viewGridRow', id);
}

See the demo from the answer as an example.

Community
  • 1
  • 1
Oleg
  • 220,925
  • 34
  • 403
  • 798
  • Hi Oleg, this is great, although is there any way of getting another button on this form? I need another button to appear, sort of like a confirmation button, upon which I can link to another form. Thanks. – moikey Feb 14 '12 at 12:28
  • @moikey: Sorry, but what you mean under "another button on this form"? If you need just have another text in the button you can use `bClose` option: `(this).jqGrid('viewGridRow', id, {bClose: "My Text"});` – Oleg Feb 14 '12 at 12:38
  • I need another button, in addition to the cancel button. Basically a "confirm" button and a "cancel" button. That is why I initially used the modal form to create the 2 buttons, but I reckon it would be much less code if it could be added to the above function. Thanks – moikey Feb 14 '12 at 12:42
  • @moikey: Which actions you see in the View dialog other as "Close"? If you do need another button - just add it inside of `beforeShowForm` callback. – Oleg Feb 14 '12 at 14:18