添加jqGrid的自定义导航顶部的工具栏 [英] Adding jqGrid Custom Navigation to Top Toolbar

查看:2434
本文介绍了添加jqGrid的自定义导航顶部的工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以导航项目添加到一个jqGrid的顶寻呼机?如果是的话,有什么语法,这样做?

Is it possible to add navigation items to the "top pager" in a jqGrid? And if so, what's the syntax for doing so?

我有我的网页的HTML代码段,看起来像这样

I have an HTML snippet on my page that looks like this

<table id="mygrid">
</table>
<div id="mygrid_pager"></div>

和那么jqGrid的初始化,看起来像这样

And then an jqGrid initialization that looks something like this

$('#mygrid').jqGrid({
    ..., //full config string removed for brevity,
    pager:jQuery('#mygrid'),
    toppager:true
}); 
$('#mygrid').jqGrid('navGrid', '#mygrid_pager'),{
    'add':false,
    'del':false,
    'edit':false,
    'search':false,
    'refresh':false,
    'cloneToTop':true,  
}).navButtonAdd('',{...}); //config navbutton string for button removed for brevity

一个顶寻呼机与#mygrid_toppager的ID自动插入到页面中,但是它的自定义按钮(这在底部出现寻呼机)不来凑凑热闹。

A "top pager" with the id of #mygrid_toppager is automatically inserted into the page, but its custom buttons (which appear on the bottom pager) don't come along for the ride.

看到有包括为navGrid一个cloneToTop选项,但它的描述显得扑朔迷离,而我只能假设我用错了。

I see that there's a "cloneToTop" option included for the navGrid, but its description seems confusing, and I can only assume I'm using it wrong.

克隆从底部寻呼机所有动作顶端寻呼机   如果定义。需要注意的是navGrid可以应用到顶端   寻呼机而已。顶端寻呼机的ID是格ID的组合和   _toppager

Clones all the actions from the bottom pager to the top pager if defined. Note that the navGrid can be applied to the top pager only. The id of the top pager is a combination of grid id and "_toppager"

我的选择的理解是将采取添加到底寻呼机按钮,并将它们克隆到顶部。然而,该描述然后继续说navGrid可应用于只有顶级寻呼机,这没有任何意义,因为你是克隆的。杜邦是,我很清楚有怎样的API是一个深刻的认识误区应该被使用。

My understanding of the option is it will take buttons added to the bottom pager, and clone them to the top. However, the description then goes on to say "the navGrid can be applied to the top pager only, which doesn't make any sense since you're cloning it. The pont being, I clearly have a deep misunderstanding of how the API is supposed to be used.

如果任何人都可以在正确的方向指向我(甚至只是一个工作示例的地方)我倒是AP preciate它。我想preFER通过官方API来做到这一点,而不是巧妙DOM操作,作为StackOverflow上看到其他地方。

If anyone can point me in the right direction (even just to a working example somewhere) I'd appreciate it. I'd prefer to do this through official APIs, as opposed to clever DOM manipulation, as seen elsewhere on StackOverflow.

推荐答案

OK,我好像找到了一种方法,看起来像更好。我们的想法是使用 navButtonAdd #list_toppager_left而不是#寻呼机

OK, it seems that I found a way which looks like better. The idea is to use navButtonAdd with the "#list_toppager_left" instead of "#pager".

我修改<一个href="http://stackoverflow.com/questions/3552855/add-toolbar-in-the-bottom-of-the-header-using-jqgrid/3557663#3557663">old回答这样,一个自定义按钮是在导航工具栏的上方加在一起有一个标准的按钮。从顶部导航工具栏的其他元素将被删除。会看起来像结果

I modified the old answer so, that one custom button are added on the top of the navigation toolbar together with one standard button. Other elements from the top navigation toolbar will be removed. The results will looks like

您可以看到相应的演示现场这里

You can see the corresponding demo live here.

这篇关于添加jqGrid的自定义导航顶部的工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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