Down.js 951 B

123456789101112131415161718192021222324252627282930313233343536
  1. /**
  2. * 明细行下移按钮
  3. */
  4. Ext.define('erp.view.core.button.Down',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.downdetail',
  7. iconCls: 'x-button-icon-down',
  8. cls: 'x-btn-tb',
  9. tooltip: $I18N.common.button.erpDownDetailButton,
  10. disabled: true,
  11. //width: 65,
  12. initComponent : function(){
  13. this.callParent(arguments);
  14. },
  15. handler: function(btn){
  16. var grid = btn.ownerCt.ownerCt;
  17. var record = grid.selModel.lastSelected;
  18. var fIdx = grid.store.indexOf(record);
  19. if(fIdx > -1) {
  20. var to = grid.store.getAt(fIdx + 1);
  21. if(to) {
  22. var keys = Ext.Object.getKeys(record.data);
  23. var v1 = Ext.Object.getValues(record.data);
  24. var v2 = Ext.Object.getValues(to.data);
  25. record.modified = {};
  26. to.modified = {};
  27. Ext.each(keys, function(key, index){
  28. if(key != grid.detno){//行编号不换
  29. record.set(key, v2[index]);
  30. to.set(key, v1[index]);
  31. }
  32. });
  33. }
  34. }
  35. }
  36. });