質問

I'm converting a large Dojo 1.1 application to Dojo 1.9.1 & in the process replacing dojox.Grid with dgrid.Grid. My initial issue was that the column headings were consistently being overwritten by the first row. Researching here I discovered that since the grids are being embedded either directly or indirectly within dijit layout widgets that I should use the dgrid.extensions.DijitRegistry mixin. However this in turn results in the grids not being displayed at all. They are being added but are being hidden by their style being explicitly set to zero width & height, which in the past I've identified as a symptom of a resize problem. These grids are on different tabs of a TabContainer each of which displays a custom widget. Each of these custom widgets implements a simple resize method which resizes the "containing" ContentPane upon which one or more grids are added.

My understanding is that the DijitRegistry mixin should cause the grid to be registered in the dijit registry & that this should mean that when resized the grid should be resized as a "dijit" child of the content pane.

Obviously something is wrong but I'm unsure where to look. Suggestions & solutions appreciated.

役に立ちましたか?

解決

It's typically just a matter of calling resize(). One technique I use when creating custom widgets that contain a dgrid is to extend from a layout widget, such as BorderContainer, instead of dijit/_WidgetBase. This gives me a hook into the resize function. I simply override it, call this.inherited(arguments), then explicitly resize my grid. Other than that, you can use .on to connect to show events on whatever the grid's container is and have it resize whenever the container is shown.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top