jqGrid tableToGrid“选项”范围

发布于 2024-08-30 05:12:21 字数 425 浏览 8 评论 0原文

基础知识

大家好,我在 jqGrid wiki 上看到 tableToGrid 方法(由 Peter Romianowski 编写)定义为 tableToGrid(selector, options),但找不到任何有相关文档的地方选项

有谁知道这些或在哪里可以找到它们?编辑:谢谢奥列格,解决了!

更多

我实际上想做的是将生成的jqGrid封装在表单中,该表单将提交位于列中的复选框值桌子。我的问题是 tableToGrid 方法似乎正在从 checkbox 元素中删除 name 属性,因此它们不会与表单发布一起提交。

Basics

Hi all, I have see the tableToGrid method (by Peter Romianowski) defined as tableToGrid(selector, options) on the jqGrid wiki, but cannot find anywhere that has documentation of the options

Does anyone know about these or where to find them? EDIT: Thanks Oleg, resolved!

More

What Im actually trying to do is encase the resulting jqGrid in a form, which will submit the checkbox values that are in a column of the table. My problem is that the tableToGrid method appears to be removing the name property from the checkbox elements and hence they are not being submitted with the form post.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

丑丑阿 2024-09-06 05:12:21

就像您可以在 http://www.trirand.com/jqgridwiki 上阅读/doku.php?id=wiki:table_to_jqgrid tableToGrid 方法的 options 参数只不过是您创建的 jqGrid 的选项(参见 http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options )。

如果我理解您的主要问题,您会从服务器收到一些数据作为表单提交的答案。您希望将这些数据放置在网格中。为此,您可以使用更直接的方式使用 jqGrid 的 datatype: 'local' 。这是一个示例:

var grid = jQuery('#list').jqGrid({
    caption: 'Testclusters',
    height: 'auto',
    gridview: true,
    rownumbers: true,
    sortable: true,
    datatype: 'local',
    viewrecords: true,
    pager: '#pager',
    pgbuttons: false,
    pginput: false,
    rownumbers: true,
    colNames: ['Name', 'Testtiefe', 'Std', 'FachlicheTests', 'RowVersion'],
    colModel: [
        { name: 'Name', index: 'Name', width: 120 },
        { name: 'TesttiefeName', width: 180 },
        { name: 'Std', width: 21, formatter: 'checkbox', align: 'center' },
        { name: 'IsFachlicheTests', width: 21, formatter: 'checkbox', align: 'center' },
        { name: 'RowVersion', width: 50, hidden: true }
                ]
}).navGrid('#pager', { edit: false, add: false, del: false, refresh: true, view: false, search: false })
  .navButtonAdd('#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns",
      onClickButton: function() {
          jQuery('#list').jqGrid('columnChooser');
      }
});
grid.jqGrid('gridResize');
var myData = [
    { Name: "VIA XP", TesttiefeName: "Alle SW-Produkte", Std:true, IsFachlicheTests:false, RowVersion: "20FC31" },
    { Name: "KUBUS", TesttiefeName: "Alle SW-Produkte", Std:false, IsFachlicheTests:true, RowVersion: "20FC32" }
];

for (var i = 0; i <= myData.length; i++) {
    grid.addRowData(i + 1, myData[i]);
}

首先创建一个空的 jqGrid,然后使用 addRowData 方法填充它。

此外,如果 jqGrid 中有很多复选框,那么从 使用基于 JavaScript 的 SVG 库在表格标题内显示垂直文本,并在 http://www.ok-soft-gmbh.com/VerticalHeaders/TestFixedO1.htm

Like you can read on http://www.trirand.com/jqgridwiki/doku.php?id=wiki:table_to_jqgrid the options parameter of tableToGrid method is nothing more as the options of the jqGrid which you create (see http://www.trirand.com/jqgridwiki/doku.php?id=wiki:options).

If I undesnand your main problem carrect, you have some data received from the server as an answer on the form submit. And you want to place this data in a grid. To make this you can use more direct way with using datatype: 'local' of jqGrid. Here is an example:

var grid = jQuery('#list').jqGrid({
    caption: 'Testclusters',
    height: 'auto',
    gridview: true,
    rownumbers: true,
    sortable: true,
    datatype: 'local',
    viewrecords: true,
    pager: '#pager',
    pgbuttons: false,
    pginput: false,
    rownumbers: true,
    colNames: ['Name', 'Testtiefe', 'Std', 'FachlicheTests', 'RowVersion'],
    colModel: [
        { name: 'Name', index: 'Name', width: 120 },
        { name: 'TesttiefeName', width: 180 },
        { name: 'Std', width: 21, formatter: 'checkbox', align: 'center' },
        { name: 'IsFachlicheTests', width: 21, formatter: 'checkbox', align: 'center' },
        { name: 'RowVersion', width: 50, hidden: true }
                ]
}).navGrid('#pager', { edit: false, add: false, del: false, refresh: true, view: false, search: false })
  .navButtonAdd('#pager', { caption: "", buttonicon: "ui-icon-calculator", title: "choose columns",
      onClickButton: function() {
          jQuery('#list').jqGrid('columnChooser');
      }
});
grid.jqGrid('gridResize');
var myData = [
    { Name: "VIA XP", TesttiefeName: "Alle SW-Produkte", Std:true, IsFachlicheTests:false, RowVersion: "20FC31" },
    { Name: "KUBUS", TesttiefeName: "Alle SW-Produkte", Std:false, IsFachlicheTests:true, RowVersion: "20FC32" }
];

for (var i = 0; i <= myData.length; i++) {
    grid.addRowData(i + 1, myData[i]);
}

First of all you create an empty jqGrid and then fill it with respect of addRowData method.

Moreover if you have many checkboxes inside of jqGrid, it can be interesting for you to look at my example from Vertical text inside table headers using a JavaScript-based SVG library and see results on http://www.ok-soft-gmbh.com/VerticalHeaders/TestFixedO1.htm.

愛放△進行李 2024-09-06 05:12:21

已解决

jqGrid tableToGrid 方法将查找原始表中复选框的值,并自动在生成的 jqGrid 上实现 multiSelect: true 选项,显示内在复选框。要获取所选行 ID 的列表,只需调用

$('#grid').getGridParam('selarrrow')

RESOLVED

The jqGrid tableToGrid method will find the value of the checkboxes in the original table and automatically implement the multiSelect: true option on the resulting jqGrid, showing intrinsic checkboxes. To get a list of the selected rows IDs, simply call

$('#grid').getGridParam('selarrrow')
九局 2024-09-06 05:12:21

更改任意数量列的列宽

在这种情况下,在 jqgrid 构建之后,您只需转到生成的表并手动更改列标题和相应数据的所有列宽,而无需纠正一些繁琐的代码。

        var tabColWidths ='70px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px';

function reDefineColWidth(){
        var widthsArr = tabColWidths.split('|');

    for(var j=0; j < widthsArr.length ; j++ ){
            $('.ui-jqgrid-labels > th:eq('+j+')').css('width',widthsArr[j]);
            $('#grid tr').find('td:eq('+j+')').each(function(){$(this).css('width',widthsArr[j]);})
        }
}

Change column width for any number of columns

In this case after the jqgrid getting build you can just go to the table getting generated and manually change all the column widths of column header and the respective data without righting some tedious code.

        var tabColWidths ='70px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px|125px';

function reDefineColWidth(){
        var widthsArr = tabColWidths.split('|');

    for(var j=0; j < widthsArr.length ; j++ ){
            $('.ui-jqgrid-labels > th:eq('+j+')').css('width',widthsArr[j]);
            $('#grid tr').find('td:eq('+j+')').each(function(){$(this).css('width',widthsArr[j]);})
        }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文