1234567891011121314151617181920212223242526272829303132333435 |
- /**
- * 明细行上移按钮
- */
- Ext.define('erp.view.core.button.Up', {
- extend : 'Ext.Button',
- alias : 'widget.updetail',
- iconCls : 'x-button-icon-up',
- cls : 'x-btn-tb',
- tooltip : $I18N.common.button.erpUpDetailButton,
- disabled : true,
- initComponent : function() {
- this.callParent(arguments);
- },
- handler : function(btn) {
- var grid = btn.ownerCt.ownerCt;
- var record = grid.selModel.lastSelected;
- var fIdx = grid.store.indexOf(record);
- if(fIdx != 0) {
- var to = grid.store.getAt(fIdx - 1);
- if(to) {
- var keys = Ext.Object.getKeys(record.data);
- var v1 = Ext.Object.getValues(record.data);
- var v2 = Ext.Object.getValues(to.data);
- record.modified = {};
- to.modified = {};
- Ext.each(keys, function(key, index) {
- if (key != grid.detno) {// 行编号不换
- record.set(key, v2[index]);
- to.set(key, v1[index]);
- }
- });
- }
- }
- }
- });
|