如何在jqgrid中自定义页眉和页脚? [英] How do I customize header and footer in jqgrid?

查看:283
本文介绍了如何在jqgrid中自定义页眉和页脚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在jqgrid中放置页眉和页脚中的几个按钮。有什么方法可以自定义它吗?

I place to place few buttons in header and footer in jqgrid. Is there any way I can customize it?

我在这个链接上的jqgrid中做了footerData选项:

I did the footerData option in jqgrid on this link:

http://www.trirand.com/jqgridwiki/doku.php?id = wiki:方法

但是我认为它是不同的和无关的。如果我错了,请告诉我。

However I think it is different and unrelated. Let me know if I am wrong.

谢谢。

推荐答案

要在导航栏中添加自定义按钮,您可以使用 navButtonAdd 方法。应在创建导航栏后使用它。导航器是寻呼机的一部分,可以位于网格的底部,网格的顶部或两者。

To add custom button in the navigator bar you can use navButtonAdd method. It should be used after the navigator bar is created. The navigator are the part of pager which can be at the bottom of the grid, on the top of the grid or both.

如果您更喜欢顶级寻呼机,您应该使用
jqGrid的 toppager:true 选项。它为寻呼机本身创建了div。 toppager的id将从网格id构建,如list和后缀_toppager(参见这里了解详情。)

If you prefer top pager you should just use toppager: true option of jqGrid. It create the div for the pager itself. The id of the toppager will be constructed from the grid id like "list" and the suffix "_toppager" (see here for details).

如果你想使用底层寻呼机你应该在HTML中定义寻呼机div页面的标记,例如id为pager的空div,并使用 pager jqGrid的参数: pager:#pager

If you want use bottom pager you should define pager div in the HTML markup of the page, for example the empty div with the id="pager" and use pager parameter of jqGrid: pager: "#pager".

要在寻呼机中创建导航栏,您应该调用 navGrid 方法。作为导航器的第一个(寻呼机)参数,您应该使用应该创建导航栏的寻呼机的ID。例如

To create navigator bar in the pager you should call navGrid method. As the first (pager) parameter of navigator you should use the id of the pager where the navigator bar should be created. For example

$("#list").jqGrid('navGrid', '#list_toppager',
    {add: false, edit: false, del: false, search: false, refresh: false});

在顶部寻呼机中创建空导航器(没有任何标准按钮)或

to create empty navigator (without any standard button) in the top pager or

$("#list").jqGrid('navGrid', '#pager',
    {add: false, edit: false, del: false, search: false, refresh: false});

创建底部寻呼机的空导航器,id =pager。如果您想创建顶部和底部寻呼机,您可以使用 cloneToTop:true

to create empty navigator of the bottom pager with id="pager". If you want create both top and bottom pager you can use cloneToTop: true:

$("#list").jqGrid('navGrid', '#pager',
    {cloneToTop: true, add: false, edit: false, del: false, search: false, refresh: false});

如果您使用一些标准按钮创建导航栏,则可以在顶部和底部导航栏之间移动按钮(请参阅此处

If you crate navigator bar with some standard buttons you can move the buttons between top and bottom navigator bars (see here).

存在导航栏后,你应该打电话给 navButtonAdd 在寻呼机指定的导航栏上添加按钮(参见这里)。要在 onClickButton 回调中获取所选行的rowid,您应该使用jqGrid的 selrow 参数(参见这里)。

After having navigator bar exist you should call navButtonAdd to add button on the navigator bar specified by the pager (see here). To get the rowid of selected row inside of the onClickButton callback you should use selrow parameter of jqGrid (see here).

这篇关于如何在jqgrid中自定义页眉和页脚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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