How to hide dijit / form / button?

I believe this is an easy way to hide / show and enable / disable the button, but I can not find any documents describing dojo. In any case, I hope it is my fault that I missed something during the search, thanks!

The following coding is what I tried, but they just make the button text invisible:

dojo.style(btnInsert, {'visibility':'hidden'}); dojo.style(btnInsert, {'display':'none'}); 

UPDATE Question:

To oborden2:

I tried my code, the result is the same as the code above, here is the captured screen:

enter image description here

In MiBrock:

I also tried your code and also got the result, the same as the above code: enter image description here

+6
source share
3 answers

The form widgets in Dijit are special. For all ordinary widgets, the Dijit domNode (external node) of the widget receives the id property. However, with widgets of the form focusNode (which corresponds to the <input> element) gets an identifier instead, so things like <label for="foo"> work correctly. In this case, the external node does not have an identifier, and you are actually just hiding the internal HTML input element.

If you already have a link to the widget:

 require([ 'dojo/dom-style' ], function (domStyle) { domStyle.set(widget.domNode, 'display', 'none'); }); 

If you only have a link to the widget / original id of the DOM node:

 require([ 'dojo/dom-style', 'dijit/registry' ], function (domStyle, registry) { domStyle.set(registry.byId(nodeId).domNode, 'display', 'none'); }); 
+10
source

Try

 require(["dojo/dom-style","dojo/domReady!"], function(domStyle){ domStyle.set(dojo.byId(domNode),'display','none'); }); 

The variable "domNode" remains for the Node identifier to be affected. So we do it.

Regards, Miriam

+1
source

Try using the Toggler module

 require(["dojo/fx/Toggler"], function(Toggler),{ // Create a new Toggler with default options var toggler = new Toggler({ node: "btnInsert" }); // Hide the node toggler.hide(); // Show the node toggler.show(); }); 

http://dojotoolkit.org/reference-guide/1.9/dojo/fx/Toggler.html

I assume that you will want to associate this with an event using the Dojo on module. Associate it with any condition so that the button is hidden.

0
source

Source: https://habr.com/ru/post/951196/


All Articles