如何使用jqGrid中的自定义数据打开Edit like form? [英] How to open Edit like form using custom data in jqGrid?

查看:213
本文介绍了如何使用jqGrid中的自定义数据打开Edit like form?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在很多页面上使用jqGrid,但在一些页面上,这些页面没有使用jqgrid,我想显示Edit like form来保持外观和感觉的一致性。



基本上,我想知道是否可以打开它jqGrid添加/编辑/查看表单(不定义全表)使用我的自定义行数据?此外,由于这些表单位于新网页上,因此我想将它们显示为常规表单,而不是以模式显示。



编辑



我看到的一种可能性是:我可以创建一个虚拟表并隐藏它并生成表单,但是这会以一种模式打开表单,我猜。最后一个选项可能是将jqGrid css应用到我的表单中。

解决方案

就像你在你的问题中已经提到的那样,创建一个隐藏的jqGrid来使用 editGridRow 方法。网格的数据可以用 data 参数填充,网格应该有数据类型:'local'。至少像 colModel colNames 等结构。为了更确定你的代码将继续在下一个版本的jqGrid中工作,创建一个隐藏的网格更好,因为创建了一些虚拟结构。

所以主要问题是如何创建非模态?的添加/编辑/查看表单。要做到这一点,你可以使用下面的添加/编辑/视图选项

  jqModal:false,
afterShowForm:function ){
$(#lui _+ grid [0] .id).hide(); //隐藏覆盖图,例如#lui_list
}

其中 grid 是网格/表格的jQuery包装: var grid = $(#list)


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.

解决方案

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").

这篇关于如何使用jqGrid中的自定义数据打开Edit like form?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆