单击jqgrid中的单元格,弹出带有自定义数据的自定义表单

问题描述:

我有一个网格控件,用于显示有关公司的数据.我希望一栏成为员工".在单击雇员"列的任何单元格时,我要弹出一个名为雇员详细信息"的表格,并希望感受数据.

I have a grid control displaying data about a Company. I want one column to be "Employee". On click on the any cell of "Employee" column I want to pop up the one Form called "Employee Details" and would like to feel the data.

我该怎么做?

据我了解,单击jqgrid单元格时的模式形式只处理与该行相关的数据.我想在弹出的表单上显示其他数据,即网格数据以外的数据.

As I understand the modal form on click of a jqgrid cell deals with data only related to that row. I want to show different data on the pop up form, i.e. other than the grid data.

请帮助.

Shivali

可能您可以使用不引人注目的链接列中(请参见

Probably you can use unobtrusive links in the column (see this and this answers). The advantage of this technique is that instead of typical links you can define any custom action on click on the link. The look of the link can be defined by CSS, but it seems to the that the link can show the user better as other HTML elements, that the user can click on it.

或者,您可以在列中使用针对自定义格式设置器的按钮,但是使用与之前所述相同的技术,您可以*定义将对点击执行的操作.

Alternative you can use a button in the column with respect of the custom formatter, but with the same technique as described before you can free define which action will be done on the click.

在带有参数'e'的click事件中,您将e.currentTarget作为链接的<a>的DOM元素,或者将<input><button>用作DOM列中的按钮.要查找行ID,可以使用var row = $(e.currentTarget).closest("tr.jqgrow")var row = $(e.target).closest("tr.jqgrow")查找<tr>元素.行ID将为row[0].id.

Inside of the click event with the parameter 'e' you have e.currentTarget as the DOM element of <a> for the link or <input> or <button> if you use buttons in the grid column. To find the row id you can use var row = $(e.currentTarget).closest("tr.jqgrow") or var row = $(e.target).closest("tr.jqgrow") to find the <tr> element. The row id will be row[0].id.