define(function (require) { return function () { var $grid; var toolbar = { xtype: 'toolbar', title: '工具条', items: [ { text: '新增', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () { } }, { text: '编辑', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () { $.yvan.msg('编辑'); } }, { text: '设置列宽', iconCls: 'fa fa-save', onClick: function () { //$grid.setColProp('idDesc', { width: 400 }); //console.log($grid.getColProp('idDesc')); //$grid.trigger('resize'); //$grid.jqGrid('setColWidth', '[idName,idDesc]', [300, 400]); $grid.jqGrid('autoResizeColumn', 3); } }, { text: '删除', iconCls: 'fa fa-minus-square fa-lg', onClick: function () { $.yvan.msg('删除'); } }, '|', { text: '关闭', iconCls: 'fa fa-times-circle fa-lg', onClick: function () { App.closeMe(this); } } ] }; //var toolbar = [ // { // text: '新增', iconCls: 'fa fa-plus-circle fa-lg', onClick: function () { // $.yvan.msg('新增'); // } // }, { // text: '编辑', iconCls: 'fa fa fa-pencil-square-o fa-lg', onClick: function () { // $.yvan.msg('编辑'); // } // }, { // text: '删除', iconCls: 'fa fa-minus-square fa-lg', onClick: function () { // $.yvan.msg('删除'); // } // }, '-', { // text: '关闭', iconCls: 'fa fa-times-circle fa-lg', onClick: function () { // $.yvan.msg('关闭'); // } // } //]; return { north: { height: 120, items: [ { xtype: 'button', text: '按钮1', onClick: function () { $grid.reset({ multiselect: true, border: false, url: demoApi('/SysIdRule/query'), toolbar: toolbar, //shrinkToFit: true, //autoSizeColumns: false, idField: 'idName', columns: [[ {field: 'idName', title: 'Id名称'}, {field: 'idDesc', title: '描述'}, {field: 'idType', title: '类型'}, {field: 'seqType', title: '序列方法'}, {field: 'seqType', title: '序列方法2', formatter: 'checkbox'}, {field: 'idExpress', title: '表达式'}, {field: 'createAt', title: '建立时间', formatter: 'ts'}, {field: 'updateAt', title: '更新时间', formatter: 'ts'} ]] }); } }, { xtype: 'button', text: '按钮2', onClick: function () { $grid.reset({ url: demoApi('/sysRole/query'), ff: 500, idField: 'roleId', columns: [[ {field: 'roleId', hidden: true}, {field: 'roleCode', title: '角色编号'}, {field: 'roleName', title: '角色名称'}, {field: 'categories', title: '角色分类', formatter: {E: '企业', A: '管理员', N: '仓库'}}, {field: 'roleDes', title: '角色描述'}, {field: 'beActive', title: '启用状态', formatter: 'beAction'}, {field: 'createAt', title: '新增时间', formatter: 'ts'}, {field: 'updateAt', title: '更新时间', formatter: 'ts'} ]] }); } } ] }, west: { border: false, width: '50%', split: true, items: { onRender: function () { $grid = $(this); }, xtype: 'grid', toolbar: toolbar, pagination: true } }, center: { border: false, items: { xtype: 'grid', border: false, //url: '/mock/id.json', url: demoApi('/SysIdRule/query'), idField: 'idName', toolbar: toolbar, columns: [ [ {field: 'idName', title: 'Id名称', width: 120}, {field: 'idDesc', title: '描述', width: 130}, {field: 'idType', title: '类型', width: 80}, {field: 'seqType', title: '序列方法', width: 100}, {field: 'idExpress', title: '表达式', width: 240}, {field: 'createAt', title: '建立时间', width: 130, formatter: fmtDate}, {field: 'updateAt', title: '更新时间', width: 130, formatter: fmtDate} ]] } } }; }; });