1. 程式人生 > >easyUI資料列表顯示條件

easyUI資料列表顯示條件

先在 $('#list').datagrid('clearSelections').datagrid('reload', { filter: '' });中寫,如果不出現則寫在URL中
//顯示條件
var tj = '?filter={ "groupOp":"AND", "rules": [{ "field":"myxd", "op":"ne", "data":"null"}], "groups": [] }';
var grid = {
    bind: function (winSize) {
        $('#list').datagrid({
            url: actionURL + tj,
            toolbar: '#toolbar',
            title: "外加工詳細",
            iconCls: 'icon icon-list',
            width: winSize.width,
            height: winSize.height,
            nowrap: false, //折行
            rownumbers: true, //行號
            striped: true, //隔行變色
            idField: 'KeyId',//主鍵
            singleSelect: true, //單選
            frozenColumns: [[]],
            columns: [[//應為寬度不是很需要所以註釋了寬度
                { title: '選擇', field: 'ck', checkbox: true },//後加進去全選欄位資料庫裡是沒有的
                { title: '序號', field: 'KeyId', sortable: true, width: '', hidden: false, editor: { type: 'numberspinner', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '訂單號', field: 'orderid', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '後加工廠', field: 'myws', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '下單人', field: 'myxd', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '開單日期', field: 'myxdrq', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '後加工收貨人', field: 'mysh', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '交貨日期', field: 'myjhrq', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '印刷品名', field: 'yspmc', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '加工尺寸', field: 'mycc', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '加工數量', field: 'mynum', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '單價', field: 'mydj', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '金額', field: 'myysf', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '製作專案', field: 'myzzxm', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } },
                { title: '加工備註', field: 'wsjgbz', sortable: true, width: '', hidden: false, editor: { type: 'textbox', options: { required: false, validType: '', missingMessage: '' } } }
                
            ]],
            onEndEdit: onEndEdit,//結束編輯時函式 這裡為了簡潔 該函式寫在下面
            onUnselect: onUnselect,
            onLoadSuccess: function (data) {
                //alert($('body').data('data70'));
                //alert($('body').data('data69'));
            },
            onCancelEdit: onCancelEdit,//在使用者取消編輯一行的時候觸發
            onSelect: onSelect,//在使用者選擇一行的時候觸發
            onClickRow: onClickRow,//在使用者點選一行的時候觸發
            //onAfterEdit: onAfterEdit,//在使用者完成編輯一行的時候觸發
            onDblClickCell: onDblClickCell,//為了程式邏輯清楚函式寫在外面
            onHeaderContextMenu: function (e, field) {//列選單實現動態隱藏列
                e.preventDefault();
                if (!cmenu) {
                    createColumnMenu();
                }
                cmenu.menu('show', {
                    left: e.pageX,
                    top: e.pageY
                });
            },
            pagination: true,
            pageSize: PAGESIZE,
            pageList: [20, 40, 50, 100, 200]
        });
    },
    getSelectedRow: function () {
        return $('#list').datagrid('getSelected');
    },
    //顯示條件
    reload: function () {
        //{"groupOp":"AND","rules":[{"field":"unit","op":"cn","data":"昆明"},{"field":"connman","op":"cn","data":"朱光明"}],"groups":[]}
        $('#list').datagrid('clearSelections').datagrid('reload', { filter: '' });
    }
};