Paste.js 745 B

1234567891011121314151617181920212223242526272829
  1. /**
  2. * 明细行粘贴按钮
  3. */
  4. Ext.define('erp.view.core.button.Paste',{
  5. extend: 'Ext.Button',
  6. alias: 'widget.pastedetail',
  7. iconCls: 'x-button-icon-paste',
  8. cls: 'x-btn-tb',
  9. tooltip: $I18N.common.button.erpPasteDetailButton,
  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. if(record){
  19. var data = grid.copyData;
  20. if(data){//如果grid的剪切板有数据
  21. var keys = Ext.Object.getKeys(data);
  22. var values = Ext.Object.getValues(data);
  23. Ext.each(keys, function(key, index){
  24. record.set(key, values[index]);
  25. });
  26. }
  27. }
  28. }
  29. });