简体   繁体   English

如何说服JqGrid columnChooser使用正确的接口?

[英]How do I persuade JqGrid columnChooser to use the correct interface?

On the demo website for jqGrid, the columnChooser module is displayed like this: 在jqGrid的演示网站上,columnChooser模块显示如下:

替代文字

It allows you to both reorder the columns and select which columns are to be shown. 它使您既可以对列进行重新排序,又可以选择要显示的列。

Unfortunately when I enter this section of code into my application(The code that is suppose to make this appear exactly as portrayed): 不幸的是,当我将这部分代码输入到我的应用程序中时(该代码原本应该正确显示):

jQuery("#colch").jqGrid('navButtonAdd','#pcolch',
                        { caption: "Columns",
                          title: "Reorder Columns",
                          onClickButton : function (){
                              jQuery("#colch").jqGrid('columnChooser');
                          } 
                        // ...

It displays a column chooser; 它显示一个列选择器; however, it only allows you to choose which columns to display and not the order the appear. 但是,它仅允许您选择要显示的列,而不选择显示顺序。 One other noticeable difference is that the interface looks nothing like the above, it is simply a list of columns that you either select or de-select, by control click to select them one at a time or shift-click to select in bulk. 另一个明显的区别是,该界面看上去与上面的样子不同,它只是您选择或取消选择的一列列表,通过单击控制一次可将其选中,或按住Shift单击可批量选择。

Here is a link to the demo site, to use as a reference. 这是演示站点的链接,用作参考。 http://trirand.com/blog/jqgrid/jqgrid.html http://trirand.com/blog/jqgrid/jqgrid.html

The problem which you have is well-known. 您遇到的问题是众所周知的。 The Column Chooser feature is described here http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser and it is an example of integration of jqGrid with other foreign components . http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser此处介绍了“列选择器”功能,它是jqGrid与其他外部组件集成的一个示例。 There are exist a jQuery UI widget (Plug-in) Mulitselect (see http://plugins.jquery.com/project/Multiselect , http://quasipartikel.at/multiselect/ and http://github.com/michael/multiselect/ ) which consist mostly from two files: 有存在一个jQuery UI插件(插件)Mulitselect(见http://plugins.jquery.com/project/Multiselecthttp://quasipartikel.at/multiselect/http://github.com/michael/ multiselect / ),主要由两个文件组成:

  • ui.multiselect.css
  • ui.multiselect.js

If you carefully read http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser you will find information about this external files. 如果您仔细阅读http://www.trirand.com/jqgridwiki/doku.php?id=wiki:jquery_ui_methods#column_chooser ,则会找到有关此外部文件的信息。

So to be able to use the Column Chooser feature like you see on demo page you need do following (together to standard steps): 因此,如要在演示页面上看到的那样,要使用“列选择器”功能,需要执行以下操作(以及标准步骤):

  • include ui.multiselect.css stylesheet 包括ui.multiselect.css样式表
  • include jQuery UI JavaScript file like jquery-ui.min.js and not only a css (like jquery-ui-1.8.2.custom.css ) which need jqGrid 包括jQuery UI的JavaScript文件像jquery-ui.min.js不仅是一个CSS(jquery-ui-1.8.2.custom.css ),它需要的jqGrid
  • include ui.multiselect.js 包括ui.multiselect.js

If you download jqGrid from http://www.trirand.com/blog/?page_id=6 you have to select "Query UI addons". 如果从http://www.trirand.com/blog/?page_id=6下载jqGrid,则必须选择“查询UI插件”。 The files ui.multiselect.css and ui.multiselect.js you will find in the subdirectories src\\css and src of the downloaded ZIP file. 您将在下载的ZIP文件的子目录src\\csssrc中找到ui.multiselect.cssui.multiselect.js文件。

Optional additional localization files for the Mulitselect widget you can download from http://quasipartikel.at/multiselect/ or http://github.com/michael/multiselect/ . 您可以从http://quasipartikel.at/multiselect/http://github.com/michael/multiselect/下载Mulitselect小部件的可选其他本地化文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM