How to open Edit like form using custom data in jqGrid?

筅森魡賤 提交于 2020-01-05 07:36:07

问题


I'm using jqGrid on lot of pages, but on some pages, which are not using jqgrid I want to show Edit like form to maintain look and feel consistency.

This thread talks about something similar but those pages have jqgrid table.

Basically, I'm wondering if its possible to open jqGrid add/edit/view form (without defining full table) using my custom row data? Additionally, since these forms are on new pages, I want to show them as a regular form, not in modal.

Edit:

One possibility I see : I can create a dummy table and hide it and generate form but this would open form in a modal, I guess. Last option could be applying jqGrid css to my forms.


回答1:


Because the form editing in a part of jqGrid I would recommend you, like you already mention in your question, to create a hidden jqGrid to use form editGridRow method. The data of the grid can be filled with respect of data parameter and the grid should has datatype:'local'. At least the structures like colModel, colNames and so on. To be more sure that your code will continue work in the next version of jqGrid creating a hidden grid is better as creating some dummy structures.

So the main question is "How to create add/edit/view form which are not modal?". To do this you can use the following Add/Edit/View options

jqModal:false,
afterShowForm:function(){
    $("#lui_"+grid[0].id).hide(); // hide overlay like "#lui_list"
}

where grid is jQuery wrapper of your grid/table: var grid = $("#list").



来源:https://stackoverflow.com/questions/6323225/how-to-open-edit-like-form-using-custom-data-in-jqgrid

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!