Toolbar3.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * 此toolbar用于单个grid的页面
  3. * 直接根据caller,到数据库取对应的button
  4. */
  5. Ext.define('erp.view.core.toolbar.Toolbar3',{
  6. extend: 'Ext.Toolbar',
  7. alias: 'widget.erpToolbar3',
  8. dock: 'bottom',
  9. height:27,
  10. initComponent : function(){
  11. var me = this;
  12. Ext.Ajax.request({
  13. url : basePath + "common/gridButton.action",
  14. params: {
  15. caller: caller
  16. },
  17. method : 'post',
  18. callback : function(options,success,response){
  19. var localJson = new Ext.decode(response.responseText);
  20. if(localJson.exceptionInfo){
  21. showError(localJson.exceptionInfo);
  22. }
  23. if(localJson.buttons){
  24. var buttons = Ext.decode(localJson.buttons);
  25. me.add('->');
  26. // put an end to the wrong link when click button
  27. Ext.each(buttons, function(b){
  28. me.add({xtype: b.xtype});
  29. });
  30. me.add('->');
  31. Ext.each(me.items.items, function(b){
  32. for(var i in buttons) {
  33. if(b.xtype == buttons[i].xtype) {
  34. b.url = buttons[i].url;
  35. break;
  36. }
  37. }
  38. });
  39. }
  40. }
  41. });
  42. this.callParent(arguments);
  43. }
  44. });