解决Dojo Grid 在TabContainer中的不显示或者刷新错误问题

前端之家收集整理的这篇文章主要介绍了解决Dojo Grid 在TabContainer中的不显示或者刷新错误问题前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

修改TabContainer.js文件,在dijit.layout.TabController中添加函数onButtonClick,大功告成!

当然这个方法有点代价有点高,如果只是为了单独解决Grid问题,可以直接each一下Grid,修改一下就可以。

  1. dojo.declare("dijit.layout.TabController",dijit.layout.StackController,{
  2. // summary:
  3. // Set of tabs (the things with titles and a close button,that you click to show a tab panel).
  4. // description:
  5. // Lets the user select the currently shown pane in a TabContainer or StackContainer.
  6. // TabController also monitors the TabContainer,and whenever a pane is
  7. // added or deleted updates itself accordingly.
  8.  
  9. templateString: "
  10. ",// tabPosition: String
  11. // Defines where tabs go relative to the content.
  12. // "top","bottom","left-h","right-h"
  13. tabPosition: "top",// doLayout: Boolean
  14. // TODOC: deprecate doLayout? not sure.
  15. doLayout: true,// buttonWidget: String
  16. // The name of the tab widget to create to correspond to each page
  17. buttonWidget: "dijit.layout._TabButton",postMixInProperties: function(){
  18. this["class"] = "dijitTabLabels-" + this.tabPosition + (this.doLayout ? "" : " dijitTabNoLayout");
  19. this.inherited(arguments);
  20. }, onButtonClick: function(/*Widget*/ page){
  21. // summary:
  22. // Called whenever one of my child buttons is pressed in an attempt to select a page
  23. this.inherited(arguments);
  24. dojo.forEach(page.getDescendants(),function(widget){
  25. if(widget.resize)widget.resize();
  26. });
  27. },
  28. //TODO: can this be accomplished in CSS?
  29. _rectifyRtlTabList: function(){
  30. //Summary: Rectify the length of all tabs in rtl,otherwise the tab lengths are different in IE
  31. if(0 >= this.tabPosition.indexOf('-h')){ return; }
  32. if(!this.pane2button){ return; }
  33.  
  34. var maxLen = 0;
  35. for(var pane in this.pane2button){
  36. maxLen = Math.max(maxLen,dojo.marginBox(this.pane2button[pane].innerDiv).w);
  37. }
  38. //unify the length of all the tabs
  39. for(pane in this.pane2button){
  40. this.pane2button[pane].innerDiv.style.width = maxLen + 'px';
  41. }
  42. }
  43. });

猜你在找的Dojo相关文章