define(function () { return function () { var $grid, v = 0; var toolbar = { xtype: 'toolbar', items: [ { text: '多机下拉菜单', menu: { xtype: 'menu', items: [ { text: '菜单1', iconCls: 'fa fa-save', onClick: function () { $.yvan.msg('菜单1'); } }, { text: '菜单2', iconCls: 'fa fa-times', onClick: function () { $.yvan.msg('菜单2'); } } ] } }, { text: 'IDS', onClick: function () { var ids = $grid.getDataIDs(); console.log(ids); } }, { text: '上移', onClick: function () { $grid.moveUp(); } }, { text: '下移', onClick: function () { $grid.moveDown(); } }, { text: '删除', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.deleteRow(); console.log('deleteRow', result); } }, { text: 'addRowForEdit', iconCls: 'fa fa-plus-circle', onClick: function () { var result = $grid.addRowForEdit({ orderqty: v++, orderqtyeach: 0, unitprice: 0, totalprice: 0 }); console.log('addRowForEdit', result); } }, { text: 'editRowId', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.editRowId(); console.log('editRowId', result); } }, { text: 'getEditRow', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.getEditRow(); console.log('getEditRow', result); } }, { text: 'setEditRow', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.setEditRow({ skuid: "G1ADKILDID7", skucode: "W060004236", polineno: '99', skuname: "罗弗8002橡皮", manufacturer: "九州通达", packcode: "W060004236", packid: "G1ADKILDID7", packtype: "3", allowexcerece: '99', uom: "3" }); console.log('setEditRow', result); } }, { text: 'saveEdit', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.saveEdit(); console.log('saveEdit', result); } }, { text: 'cancelEditRow', iconCls: 'fa fa-minus-square', onClick: function () { var result = $grid.cancelEditRow(); console.log('cancelEditRow', result); } } ] }; return { center: { border: false, items: [ { onRender: function () { $grid = $(this); }, onBeginEditRow: function () { console.log('beginEditRow', this, arguments); }, onRestoryEditRow: function () { console.log('restoryEditRow', this, arguments); }, onSaveEditRow: function () { console.log('saveEditRow', this, arguments); }, onReadysetEditRow: function () { console.log('readysetEditRow', this, arguments); }, url: '/mock/docpo.json', xtype: 'grid', idField: 'skuid', toolbar: toolbar, editable: true, multiselect: true, //multiboxonly: true, editOnSelected: true, //editOnDblClick: true, autoSizeColumns: false, pagination: false, columns: [[ { field: 'skuid', hidden: true }, { field: 'polineno', hidden: true }, { field: 'skucode', title: '产品编号', width: 180, editor: { xtype: 'searchbox', required: true, widget: { url: '/widget/selectDocSku.js', bind: { skuid: 'skuId', skucode: 'skuCode', skuname: 'skuName', manufacturer: 'manufacturer', packcode: 'packCode', packid: 'packId', uom: 'packType', packtype: 'packType', packmeasspec: 'packMeasspec', zpackMeasspec: 'zpackMeasspec' } } } }, { field: 'skuname', title: '产品名称', width: 200, formatter: 'c1' }, { field: 'manufacturer', title: '生产厂家', width: 140, formatter: 'c2' }, { field: 'packcode', title: '包装编号', width: 100 }, { field: 'uom', title: '收货单位', width: 100, editor: { xtype: 'combobox', required: true, data: $.yvan.bizDict('packingType').combo(), onChange: function () { $.yvan.msg('收货单位.onChange'); } } }, { field: 'orderqty', title: '订单数量(主单位)', width: 120, editor: { xtype: 'numberbox', precision: 2, required: true, validType: 'gtZero', onChange: function () { $.yvan.msg('订单数量.onChange'); } } }, { field: 'orderqtyeach', title: '订单数量(收货单位)', width: 120, editor: { xtype: 'numberbox', precision: 2, required: true, onChange: function () { $.yvan.msg('订单数量.onChange'); } } }, { field: 'unitprice', title: '含税单价', width: 100, editor: { xtype: 'numberbox', precision: 2, onChange: function () { $.yvan.msg('含税单价.onChange'); } } }, { field: 'totalprice', title: '含税金额', width: 100, editor: { xtype: 'numberbox', precision: 2, onChange: function () { $.yvan.msg('含税金额.onChange'); } } }, { field: 'allowexcerece', title: '超量收货', width: 100, editor: { xtype: 'checkbox', on: '99', off: '10', onChange: function () { $.yvan.msg('超量收货.onChange'); } } }, { field: 'excereceperc', title: '超量百分比', width: 100, editor: { xtype: 'numberbox', precision: 2, onChange: function () { $.yvan.msg('超量百分比.onChange'); } } }, { field: 'packid', hidden: true }, { field: 'packtype', hidden: true }, { field: 'packmeasspec', hidden: true }, { field: 'zpackMeasspec', hidden: true }, { field: 'pono', hidden: true } ]] } ] } }; }; });