免费的jqGrid 4.8.0-向工具栏添加按钮 [英] Free jqGrid 4.8.0 - Add buttons to toolbar

查看:67
本文介绍了免费的jqGrid 4.8.0-向工具栏添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我了解到可以通过添加工具栏:[true.'top'](向网格顶部添加空工具栏的示例)来向网格添加工具栏.

如何向该工具栏添加按钮?我知道jqGrid('navButtonAdd',nameOfPager)的工作原理,也熟悉toppager选项,但不知道如何向我上面提到的工具栏添加按钮.

谢谢

解决方案

jqGrid没有用于操作toolbar: [true, "top"]的API.工具栏的唯一目标是jqGrid内的<div>.在调整网格大小时,将更改CSS width属性,但不会做任何其他事情.

答案提供(请参见将信息添加到工具栏.如果网格ID不包含特殊字符(.,等),则可以使用简化的选择器"#t_" + $grid[0].id.

以相同的方式,可以将导航器按钮从标准位置移动到顶部工具栏.如果您有许多工具栏按钮,可能会很实用.我为您创建了演示,以演示这一点.

一个解决方案可以与我在答案 createContexMenuFromNavigatorButtons和showHideColumnMenu方法结合使用>

该方法接近另一种答案,其中一个人希望在网格顶部具有大按钮以使其更加美观对Tablet PC(例如iPad)的用户友好.

存在功能请求,并带有在其中添加功能的示例顶部工具栏.我觉得这个想法很有趣,希望能找到相应实现的写作.

I learn there is an option to add a toolbar to the grid by adding toolbar:[true.'top'] (example for adding an empty toolbar to the top of the grid).

How do I add buttons to that toolbar? I know how jqGrid('navButtonAdd', nameOfPager) works and also familier with the toppager options, but don't know how to add buttons to the toolbar I just mentioned above.

Thanks,

解决方案

jqGrid have no API for manipulation of the toolbar: [true, "top"]. The only goal of the toolbar is a <div> inside of jqGrid. The CSS width attribute will be changed during resizing the grid, but nothing more will be done.

The answer provides (see the demo) provides a practical example of the usage of the toolbar. It add information using $("#t_" + $.jgrid.jqID($grid[0].id)).append to the toolbar. In case if the grid id don't contains special characters (., , and other) one can use simplified selector "#t_" + $grid[0].id.

In the same way one can move the navigator buttons from the standard place to the top toolbar. It could be practical it you have many toolbar buttons. I created the demo for you which demonstrates this.

One can combine the solution with createContexMenuFromNavigatorButtons and showHideColumnMenu methods which I described in the answer

The approach is close to another answer where one wanted to have large button on top of the grid to make it more friendly for the users of Tablet PC (iPad for example).

There are exist the feature request with an example of adding functionality in the top toolbar. I find the idea interesting and I hope that I will find for the writing of the corresponding implementation.

这篇关于免费的jqGrid 4.8.0-向工具栏添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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