Dojo:show() 和 hide() .... 怎么做?
我有一个容器元素,在其中动态/放置()创建一个表单,然后创建另一个表单......等等。 我的目标是在它们之间切换,即隐藏全部并仅显示活动形式。 它隐藏得很好,但我无法显示活动的背面。
我尝试使用:
- .style.display(none<->block) 和visibility(visibility<->hidden)
- dojo.style(...)
- resize() 和startup() 更改后
- 我发现的其他几个变体旧道场的互联网
不起作用。 /我需要它与显示一起工作,这样它就不会占用空间。/
你能告诉我用 dojo() 显示和隐藏的正确方法是什么吗?
还看了这个: 如何动态显示和隐藏整个 TabContainer 使用 DOJO?
不起作用。
我使用的伪代码是这样的: ....
//find or create the FORM element
form = dijit.byId(...);
if(typeof form != 'object') {
form = dojo.create('form', ....);
dojo.place(form,'containerx','last');
}
//hide all
dojo.query('#containerx > *').forEach(function(item){
dojo.style(item, 'visibility','hidden');// and all other variants i mentioned
})
//show only the current form
dojo.style(form, 'visibility','visible');
//if the dojo form obj was already created, then skip it
if (this.form_obj) return;
....build the form and the elements....
this.form_obj.startup()
谢谢
I have a container element in which I create on the fly/place() a form, then another one..etc.
My goal is to switch between them i.e. hide all and show only the active form.
It hides alright, but I can't show the active back.
I tried using:
- .style.display(none<->block) and visibility(visibility<->hidden)
- dojo.style(...)
- resize() and startup() after the changes
- Several other variants i found on Internet from old dojo's
Nothing works.
/I need it to work with display, so that it does not occupy space./
Can you tell me what is the correct way to show and hide with dojo()
Also looked at this one :
How do I dynamically show and hide an entire TabContainer using DOJO?
Does not work.
The pseudo code I use is something like this :
....
//find or create the FORM element
form = dijit.byId(...);
if(typeof form != 'object') {
form = dojo.create('form', ....);
dojo.place(form,'containerx','last');
}
//hide all
dojo.query('#containerx > *').forEach(function(item){
dojo.style(item, 'visibility','hidden');// and all other variants i mentioned
})
//show only the current form
dojo.style(form, 'visibility','visible');
//if the dojo form obj was already created, then skip it
if (this.form_obj) return;
....build the form and the elements....
this.form_obj.startup()
thanx
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您可能正在寻找 StackContainer 功能。
只需进行设置,使 StackContainer 将 dijit.form.Forms 作为子级,您就可以使用 selectChild 方法来选择要显示的表单。
Sounds like you might be looking for StackContainer functionality.
Just set things up so that the StackContainer has the dijit.form.Forms as children and you can use the selectChild method to choose what form to display.
我刚刚回答了您几分钟前在问题中提到的那个线程中的问题。基本上它涉及到 jQuery 的参与。对我来说效果很好。我已经静态创建了所有选项卡(而不是以编程方式),并且我能够在 jQuery 的帮助下控制它们是显示还是隐藏。所有代码都在我的帖子中:
如何使用 DOJO 动态显示和隐藏整个 TabContainer?
I just answered the question in that thread you referenced in your question a few minutes ago. Basically it involved getting jQuery involved. Works great for me. I have all the tabs created statically (as opposed to programatically) and I'm able to manipulate whether they are shown or hidden with the help on jQuery. All the code any everything is in my post here:
How do I dynamically show and hide an entire TabContainer using DOJO?