简体   繁体   English

Dojo动态调整小部件的大小

[英]dojo dynamic resizing of widgets

I'm a dojo beginner and got a "huge" project on the table which uses dojo 1.3.2 (upgrading to a newer version is atm not possible). 我是dojo初学者,并且在使用dojo 1.3.2的桌面上有一个“巨大”项目(不可能升级到较新版本的atm)。 I'm consuming the documentation as far as possible for this old version and I'm making progress, but there are still corners in the dojo maze I'm not aware of or I don't understand completely. 我正在尽可能多地使用此旧版本的文档,并且正在取得进步,但是在dojo迷宫中仍然有一些角落,我不清楚或我不太了解。 I hope my question will not be a duplicate since I couldn't find a answer to my question yet. 我希望我的问题不会重复,因为我还没有找到答案。

In the project is a widget which will get visible or hidden. 在项目中是一个小部件,它将变得可见或隐藏。 At some user-actions the widget should resize dynamically. 在某些用户操作下,小部件应动态调整大小。 I achieved a logic for that by using dojo.query (to access the right dom nodes) and dojo.style (for doing the actual resizing) and this works fine so far. 通过使用dojo.query (访问正确的dom节点)和dojo.style (用于进行实际的大小调整),我实现了一个逻辑,到目前为止,它仍然可以正常工作。

There is just one problem: if the widget gets shown for the first time it has a default size (which comes from html) although the function gets called via onShown-function of the widget. 只是有一个问题:如果第一次显示小部件,则它具有默认大小(来自html),尽管该功能是通过小部件的onShown函数调用的。 My reiszing logic will only affect the widget after a user-action happened that causes a resizing or the next time the widget will be shown. 我的重新排列逻辑只会在发生导致调整大小的用户操作或下次显示窗口小部件之后才影响窗口小部件。

Is there anything where I should look into which could cause such behavior by standard? 有什么我应该调查的地方可以导致这种行为的标准吗? I would appreciate every hint, since I can't tell if there are dependecies through the project which cause this behavior. 我会很感激每一个提示,因为我无法确定项目中是否存在导致这种行为的依赖项。 Anyway this seems for me to be related to dojo and it's logic, since trying a second call ect does not help. 无论如何,这对我来说似乎与dojo有关,这是逻辑上的,因为尝试第二个调用ect并没有帮助。

Thanks! 谢谢!

I suggest you read up on the dijit lifecycle: 我建议您阅读dijit生命周期:

O'Reilly's definitive guide is really out of date, but this is actually a good thing for 1.3.2: http://chimera.labs.oreilly.com/books/1234000001819/ch12.html#the_widget_lifecycle 奥赖利(O'Reilly)的权威指南确实已经过时了,但这对1.3.2来说确实是一件好事: http : //chimera.labs.oreilly.com/books/1234000001819/ch12.html#the_widget_lifecycle

The nearest Dojo docs I can find are for 1.6, but should basically apply: http://dojotoolkit.org/reference-guide/1.6/dijit/_Widget.html 我能找到的最近的Dojo文档适用于1.6,但基本上应该适用: http : //dojotoolkit.org/reference-guide/1.6/dijit/_Widget.html

You want to look at startup() - that's important, as startup() is the first lifecycle method where the widget is expected to be placed in the DOM. 您需要查看startup()-这很重要,因为startup()是第一个将小部件放置在DOM中的生命周期方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM