【问题标题】:Can I add a header row under the column header row in JQGrid我可以在 JQGrid 的列标题行下添加标题行吗
【发布时间】:2014-04-18 13:59:19
【问题描述】:

我目前的代码可以创建一个非常标准的 JQGrid。但是,我现在想在每个标题下方添加一些搜索功能。我不想使用我见过的内置搜索栏,因为它只提供文本框,不能很好地按日期范围搜索。所以我希望有一种方法可以将表格行添加到 JQgrid 中,我可以自己编写内容。

基本上,这就是我希望网格的样子:

--------------------------------
| JQGrid Header
--------------------------------
| Column 1  |  Column 2     | Col...
--------------------------------
| My new row here
--------------------------------
| Data row 1
--------------------------------
| Data row 2
--------------------------------
| Data row etc...
--------------------------------
| Footer
--------------------------------

我已经为之前的项目构建了这个搜索功能,所以我只想要一个可以放入的空 div 或表格行。我只是不知道如何在 JQGrid 列标题和 JQGrid 数据之间插入一个。

谢谢。

【问题讨论】:

    标签: jqgrid


    【解决方案1】:

    我发现这不再是完成我想做的事情所必需的。相反,我正在使用我当时不知道的其他搜索选项:

    colModel:   [
                    <cfloop from="1" to="#ListLen(attributes.ColumnHeaderList)#" index="x">
                        {   name: '#ListGetAt(attributes.ColumnFieldList, x)#',
                            index: '#ListGetAt(attributes.ColumnFieldList, x)#',
                            width: #ListGetAt(attributes.columnWidthList, x)#,
                            sorttype: '#ListGetAt(attributes.columnTypeList, x)#',
                            search:true,
                            stype:'<cfif datasearchtype[x] is 3>text<cfelse>select</cfif>',
                            searchoptions: {
                                value:{#DataSearchOptions[x][1]#}
                            }
                        }
                        <cfif x is not ListLen(attributes.ColumnHeaderList)>,</cfif>
                    </cfloop>
                ],
    

    基本上,我有一些coldFusion 代码来解析查询返回的数据,然后确定应该如何搜索该列。对于日期或数字范围,我创建了一个带有合理选项的下拉列表(即:“Jan”、“Feb”、“March”或“Jan 2013 - Jun 2013”​​、“Jul 2013 - Dec 2013”​​等),并使用“searchoptions”属性让 JQuery 为我创建选择框。对于其他值,我离开搜索栏以使用直接文本字段。

    这为更强大的弹出式搜索框提供了一种方便的替代方案,并且选择提供了一种更直观、更有效的方式来解析日常使用的数据。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-10
      • 2015-04-14
      • 2011-01-02
      • 2020-01-28
      • 1970-01-01
      • 2013-11-03
      • 2015-01-18
      • 1970-01-01
      相关资源
      最近更新 更多