jqGrid插件学习(3)-支持子表格

jqGrid默认的子表格只需开启subGrid:true, 并设置相应的subGrid配置参数即可.

如果subGrid是一个完整的jqGrid表格, 可以这样:

var $grid = $("#myTable");
$grid.jqGrid({

    ...

    subGrid:true,

    subGridRowExpanded: function(subgrid_id, row_id) {
            var table_id = subgrid_id + "_t";
            var $subGrid = $grid.find("#"+table_id);
            if(!$subGrid.length) {
            $subGrid = $("<table id='"+table_id+"'></table>");
            $("#"+subgrid_id).empty().html($t);

            subGrid.jqGrid({...});

});

你可能感兴趣的:(JavaScript,jquery,jqGrid)