1. jqgrid左下角的复杂搜索框显示为下拉框样式
    searchoptions: { value: ": 全部; 1: 在用; 2: 报废", sopt: ['eq'] }
    使用JQGrid  问题汇总   不定时更新

     

  2. jqgrid左下角的复杂搜索框显示为下拉框样式,界面需引用datepicker.js文件,API示例
     searchoptions: { dataInit: function (elem) { jQuery(elem).datepicker({ format: 'yyyy-mm-dd' }); }, attr: { title: '选择日期' }, sopt: ['cn', 'nc', 'in', 'ni'] }
    使用JQGrid  问题汇总   不定时更新

     

  3. 表头搜索为下拉框样式
    stype: 'select', search: true, editoptions: { value: ": 全部; 1: 一级", size: 32 },
    使用JQGrid  问题汇总   不定时更新

     

  4. jqGrid没有数据标题超出容器部分无法滚动
     1:在table上加height=1px  
    使用JQGrid  问题汇总   不定时更新

    2:加载grid的时候

        jQuery("#grid-table").jqGrid({
            jsonReader: {
                id: "", //相当于设置主键
                root: "rows", // json中代表实际模型数据的入口
                page: "", // json中代表当前页码的数据
                total: "", // json中代表页码总数的数据
                records: "", // json中代表数据行总数的数据
                repeatitems: false
            },
            loadComplete: function (data) {
                //注意重新配置过jsonReader不是默认,记得修改数据节点名称rows,就是jsonReader中的root节点的配置项
                if (data.rows.length == 0) $('head').append('<style> .ui-jqgrid .ui-jqgrid-hdiv{overflow:auto}</style>');
            }
        }

     

    有数据使用JQGrid  问题汇总   不定时更新,无数据使用JQGrid  问题汇总   不定时更新

     

  5. 如果grid存在于界面中的模态框中,需要打开模态框的时候刷新显示最新的数据
    可以在点击打开模态框的按钮上加【  $('#refresh_grid-table').click(); 】
    并在初始化JQGrid时加上
     jQuery("#grid-table").jqGrid({});
     jQuery("#grid-table").jqGrid('navGrid', pager_selector, { del: false, add: false, edit: false, search: false });
    原理就是利用JQGrid本身的自有的刷新方法实现

  6. 外部有筛选条件刷新表格时,下边工具栏中当前页面没有改变

    jQuery("#grid-table").jqGrid('setGridParam', {page: 1,url: url }).trigger("reloadGrid");

  7. 将后台返回的日期格式化
    先执行js方法     javascript Date format(js日期格式化)
    Date.prototype.Format = function (fmt) { //author: meizz 
        var o = {
            "M+": this.getMonth() + 1, //月份 
            "d+": this.getDate(), //
            "h+": this.getHours(), //小时 
            "m+": this.getMinutes(), //
            "s+": this.getSeconds(), //
            "q+": Math.floor((this.getMonth() + 3) / 3), //季度 
            "S": this.getMilliseconds() //毫秒 
        };
        if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        for (var k in o)
        if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
        return fmt;
    }
    View Code

相关文章:

  • 2021-06-27
  • 2021-04-12
  • 2021-12-30
  • 2021-08-16
  • 2021-04-03
  • 2021-11-18
  • 2021-08-21
  • 2021-11-15
猜你喜欢
  • 2021-12-18
  • 2021-11-19
  • 2022-12-23
  • 2021-11-02
  • 2022-01-20
  • 2021-10-04
  • 2022-12-23
相关资源
相似解决方案