miniui datagrid 创建表格

来源:互联网 发布:java乘法函数 编辑:程序博客网 时间:2024/06/05 11:08

(1)html中创建

  <div id="YourGridId" class="mini-datagrid"                     url="@Url.Content("YourActionUrl")"                     ajaxtype="post"                     showpager="false"                     showloading="true"                     showmodified="false"                     allowcelledit="true"                     allowalternating="true"                     allowcellselect="true"                     multiselect="true"                     allowrowselect="true"                     allowmovecolumn="false"                     style="height: 100%; width: 100%">                    <div property="columns">                        <div type="indexcolumn" width="20"></div>                        <div header="关键词" headeralign="center">                            <div property="columns">                                <div name="name1" field="name1" headeralign="center" align="left" width="150" autoescape="true">                                    1                                </div>                                <div name="name2" field="name2" align="left" width="150" headeralign="center" autoescape="true">                                    2                                </div>                            </div>                        </div>                    </div>                </div>
相关js代码如下

$(function() {        mini.parse();        InitMedcondGrid();     });///初始化列表内容function InitMedcondGrid  () {    var grid = mini.get(“YourGridId”);    grid.load();}

(2)在js中设置datagrid

html:

 <div id="YourGridId" class="mini-datagrid" style="height: 100%; width: 100%;"></div>
js:

$(function() {        mini.parse();        InitMedcondGrid();     });

function DrugDataGridInt () {    var columns = [        { type: "indexcolumn" },        { field: 'id', header: '编号', width: 50, align: 'left', visible: false },
        { field: 'code', header: '编码', width: 120, headerAlign: 'center',autoescape:true },        { field: 'name', header: '名称', width: 200, headerAlign: 'center', autoescape: true }    ];    var grid = mini.get("YourGridId");     grid.set({        url: YourUrl,        sizeList: [50,100],        pageSize: 50,        columns: columns,        allowAlternating: true, //显示间行色        multiSelect: true,        fitColumns: false, //使用过滤行必须设定这个全充满,否则会有列对齐问题。        allowCellEdit: true,        allowCellSelect: true,         showFilterRow: false,        showModified: false,        allowMoveColumn: false);    grid.load(); }



原创粉丝点击