如何在jqgrid中添加第二行 [英] How to add second row in jqgrid

查看:88
本文介绍了如何在jqgrid中添加第二行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,我具有以下jqgrid结构:

Currently I have the following jqgrid structure:

colName:['ID','Name'],
colModel:[ {<ID CODE HERE>},{<NAME CODE HERE>}],
<REST OF CODE HERE>

上面的jqgrid显示如下:

The above jqgrid displays fine as follows:

ID    Name
1     Name1
2     Name2

我想在其上方显示一行动态数据.如:

I want to display one row above it with dynamic data. Such as:

Period
From 10/10/2013 To 10/10/2014
ID    Name
1     Name1
2     Name2

句点"行是静态单词,而其下一行从10/10/2013到10/10/2014"则是来自后端的动态数据,就像Name1和Name2等.

The "Period" row is static word while the row below it "From 10/10/2013 To 10/10/2014" is dynamic data coming from backend just like Name1, and Name2 etc.

如何在其上方显示这两行?

How can I display these two rows above it?

推荐答案

可以在列标题上方创建网格的两个标准元素:标题(网格标题)和顶部工具栏(有关示例图片,请参见此处) .这两个标头都可以保存任何包含<br/>的公共HTML数据.

There are two standard element of grid which can be created over column headers: caption (grid header) and top toolbar (see here for pictures with examples). Both the headers can hold any common HTML data inclusive <br/>.

可以通过使用非空的caption参数创建初始字幕.您可以随时使用 setCaption 方法进行更改.

Initial caption can be created by usage non-empty caption parameter. You can change it at any moment using setCaption method.

要创建顶部工具栏,应包含toolbar: [true, "top"]选项.它将在网格标题上创建其他div. div具有类"ui-userdata"和基于网格ID构造的ID:"t _" + grid_id.如果需要在div中放置多行信息,则应覆盖默认CSS.参见答案这一个以了解更多详细信息和代码示例.

To create top toolbar you should include toolbar: [true, "top"] option. It create additional div over the grid header. The div have the class "ui-userdata" and the id constructed based on the id of the grid: "t_" + grid_id. If you need to place multiline information in the div you should overwite default CSS. See the answer, this one and this one for more details and code examples.

这篇关于如何在jqgrid中添加第二行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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