Future曙光 2019-05-25 09:44 采纳率: 0%
浏览 557

使用jQuery的jquery.fixedheadertable时出现的问题

  先上jsp代码片段,如下: 图片说明

  当我加上代码中选中的部分时,表格效果就变成了这样:
图片说明

  其中表头和左侧两列实现了固定,但是可以看到,表头和左侧两列的字段都变成了空白,而如果去掉“fixedColumns: 2”这句代码后,就一切正常,请问这是什么原因呢?

  • 写回答

1条回答 默认 最新

  • 专家-郭老师 Java领域新星创作者 2019-05-25 10:20
    关注

    你应该在加载数据里写固定列的代码,而不是单独去写。在你加载数据的js里写。

    easyui 例子:
    <script type="text/javascript">
        var dataGrid;
        var orders = '${USER_SESSION.funIds}';
        $(function() {
    
            dataGrid = $('#dataGrid').datagrid({
                loadMsg: '数据加载中....',
                url: '${pageContext.request.contextPath}/sdCstmInfoController.do?cstmGrid2',
                fit: true,
                fitColumns: true,
                border: false,
                pagination: true,
                idField: 'id',
                pageSize: 10,
                pageList: [10, 20, 50, 100, 200],
                sortName: 'id',
                sortOrder: 'desc',
                nowrap: false,
                rownumbers: true,
                border: true,
                striped: true,
                singleSelect: true,
                checkOnSelect: false,
                selectOnCheck: false,
                frozenColumns: [[{            //**_这个就是固定列**_
                    field: 'id',
                    title: '编号',
                    width: 150,
                    checkbox: true
                }, {
                    field: 'customName',
                    title: '姓名',
                    width: 100,
                    sortable: true,
                    formatter: function(value, row) {
                         return "<strong><a style='color:#1E90FF;font-weight:bold' href='#' onclick='doSomething("+row.id+")'>"+value+"</a></strong>";                              
                    }
                },{
                    field: 'sex',
                    title: '性别',
                    width: 50,
                    sortable: true,
                    formatter: function(value, row) {
                        if ("1" == value) return "<strong style='color:blue'>男<strong>";
                        else if ("2" == value) return "<strong style='color:green'>女<strong>";
                    }
                }, {
                    field: 'mingZu',
                    title: '民族',
                    width: 60,
                    sortable: true
                },  
                {
                    field: 'idCard',
                    title: '身份证',
                    width: 120,
                    sortable: true
                }, 
                {
                    field: 'customTel',
                    title: '联系电话',
                    width: 80,
                    sortable: true
                }, {
                    field: 'cadreState',
                    title: '离退休状态',
                    width: 70,
                    sortable: true,
                    formatter: function(value, row) {
                        if(value == 1) return "<strong style='color:#EA7500'>离休</strong>";
                        else if(value ==2) return "<strong style='color:blue'>退休</strong>";                 
                    }
                },{
                    field: 'retirementDate',
                    title: '离退休时间',
                    width: 70,
                    sortable: true              
                }]],
                columns: [[{
                    field: 'auditState',
                    title: '审核状态',
                    width: 90,
                    sortable: true,
                    formatter: function(value, row) {
                        if ("1" == value) return "<strong style='color:blue'>未审核<strong>";
                        else if ("2" == value) return "<strong style='color:green'>审核通过<strong>";
                        else if ("3" == value) return "<strong style='color:red'>审核未通过<strong>";
                    }
                }, {
                    field: 'jianKangZhuangK',
                    title: '健康状况',
                    width: 90,
                    sortable: true
                }, {
                    field: 'yangLaoFangShi',
                    title: '养老方式',
                    width: 130,
                    sortable: true
                }]],
                toolbar: '#toolbar',
                onLoadSuccess: function() {
                    $(".edit_button").linkbutton({
                        text: '审核',
                        plain: true,
                        iconCls: 'icon-audit16'
                    });
                    doCellTips(true);
                },
                onRowContextMenu: function(e, rowIndex, rowData) {
                    e.preventDefault();
                    $(this).datagrid('unselectAll').datagrid('uncheckAll');
                    $(this).datagrid('selectRow', rowIndex);
                    $('#menu_tools').menu('show', {
                        left: e.pageX,
                        top: e.pageY
                    });
                }
            });
        });
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配