JqGrid ask for new fields on click custom button

2019-01-29 05:39发布

问题:

I have added a custom button to the navigator in my jqgrid and i am wondering how can i ,when i click on the button, show a dialog with the same style as the edit dialog and ask for some especific fields that are not included in the colModel. Those field would be to be sent to the server when clicking on ok button.

Any ideas?

Thanks in advance.

Carlos.

回答1:

You can display the "Edit" dialog using editGridRow method. In the second (properties) parameter of the method you can include your custom beforeShowForm event handler which can make any modifications in the dialog.

See last demo from the answer for an example. The demo has the line

$('<tr class="FormData" id="tr_AddInfo"><td class="CaptionTD ui-widget-content">'+
  '<b>Additional Information:</b></td></tr>').insertAfter (nameColumnField);

inside of beforeShowForm.

If the information which you need to show in the dialog are from the hidden column of the grid you can use simplified way which you find here. The main idea in the solution is that jqGrid include in the form dialog all hidden fields, but the corresponding row is hidden. So it is enough just to show the hidden row.



标签: button jqgrid