zoukankan      html  css  js  c++  java
  • jgGrid

    jqGrid的表格加载

     1     function GetGrid() {
     2         var selectedRowIndex = 0;
     3         var $gridTable = $("#gridTable");
     4         $gridTable.jqGrid({
     5             datatype: "json",
     6             height: $(window).height() - 141,
     7             auto true,
     8             colModel: [
     9                 { label: '主键', name: 'pk', hidden: true },
    10                 { label: "表名", name: "tableName",  300, align: "left", sortable: false },
    11                 {
    12                     label: "记录数", name: "tableRows",  100, align: "center", sortable: false,
    13                     formatter: function (cellvalue, options, rowObject) {
    14                         return cellvalue + "条";
    15                     }
    16                 },
    17                 { label: "说明", name: "tableComment",  120, align: "left", sortable: false },
    18                 { label: "表分类",name: "catKindName",  100, align: "left",sortable: false},
    19                 { label: "分类码",name: "catCode",  0, align: "left",sortable: false,hidden:true}
    20                 
    21             ],
    22             onSelectRow: function () {
    23                 selectedRowIndex = $("#" + this.id).getGridParam('selrow');
    24             },
    25             gridComplete: function () {
    26                 $("#" + this.id).setSelection(selectedRowIndex, false);
    27             },
    28             rowNum: "1000",
    29             rownumbers: true,
    30             shrinkToFit: false,
    31             gridview: true,
    32             subGrid: true,
    33             subGridRowExpanded: function (subgrid_id, row_id) {
    34                 var tableName = $gridTable.jqGrid('getRowData', row_id)['tableName'];
    35                 var subgrid_table_id = subgrid_id + "_t";
    36                 $("#" + subgrid_id).html("<table id='" + subgrid_table_id + "'></table>");
    37                 $("#" + subgrid_table_id).jqGrid({
    38                     url: "dataSourceTableController.do?tableStructrue",
    39                     postData: { dataBaseLinkId: _DataBaseLinkId, tableName: tableName },
    40                     datatype: "json",
    41                     height: 260,
    42                     colModel: [
    43                         { label: "列名", name: "columnName", index: "columnName",  300, sortable: false },
    44                         { label: "数据类型", name: "dataType", index: "dataType",  120, align: "center", sortable: false },
    45                         { label: "长度", name: "characterMaximumLength", index: "characterMaximumLength",  57, align: "center", sortable: false },
    46                         { label: "允许空", name: "isNullable", index: "isNullable",  58, align: "center", sortable: false },
    47                         { label: "主键", name: "columnKey", index: "columnKey",  57, align: "center", sortable: false },
    48                         { label: "默认值", name: "columnDefault", index: "columnDefault",  120, align: "center", sortable: false },
    49                         { label: "说明", name: "columnComment", index: "columnComment",  200, sortable: false }
    50                     ],
    51                     caption: "表字段信息",
    52                     rowNum: "1000",
    53                     rownumbers: true,
    54                     shrinkToFit: false,
    55                     gridview: true,
    56                     hidegrid: false
    57                 });
    58             }
    59         });
    60         //查询事件
    61         $("#btn_Search").click(function () {
    62             getTableList();
    63         });
    64         $("#txt_Keyword").keydown(function () {
    65             getTableList();
    66         });
    67         function getTableList(){
    68             $gridTable.resetSelection();
    69             selectedRowIndex = 0;
    70             $gridTable.jqGrid('setGridParam', {
    71                 url: "dataSourceTableController.do?allTables",
    72                 postData: { dataBaseLinkId: _DataBaseLinkId, keyword: $("#txt_Keyword").val() },
    73             }).trigger('reloadGrid');
    74         }
    75     }
  • 相关阅读:
    Day01
    微前端技术框架qiankun技术分享
    终于有人把O2O、C2C、B2B、B2C的区别讲透了
    Electron-Vue项目使用Element的el-table组件不显示
    monaco editor各种功能实现总结
    electron-vue项目使用elementUI组件报错$attrs is readonly
    monaco-editor 使用总结
    闲谈Monaco Editor-基本使用
    【软件】MATHTYPE破解记
    C# EF
  • 原文地址:https://www.cnblogs.com/Eeexiang/p/9203734.html
Copyright © 2011-2022 走看看