Skip to main content

How to enable/disable widgets

4 replies [Last post]
castertroy
Offline
Joined: 2009-04-01
Points: 0

Hi,

Is there a way to enable/disable widgets? I'm using a dojo tree on my left panel for navigation. Forms are displayed on a center panel. I need to disable the dojo tree to avoid navigation while a record is being edited on the center panel. Can anyone point me out how to do this?

Thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

The best way to enable or disable a widget is to use the div id and set the display property on the div like follows assuming the div id is "mywidget"

document.getElementById("mywidget").style.dsiplay = "none"; // disable

To reenable:

document.getElementById("mywidget").style.dsiplay = "block"; // disable

Let me know if you have problems with it.

-G

castertroy
Offline
Joined: 2009-04-01
Points: 0

Hi Greg,

Thanks for the swift response. I've already used that method... Functional wise, it gets the job done. But it results to user confusion on what happened to the missing part of the page. Also leaves an unpleasant look on the page :D Any other suggestions? I'm trying to disable a dojo tree.

thanks

gmurray71
Offline
Joined: 2003-07-31
Points: 0

Hi,

I didn't realize you just wanted to disable the tree.

Given the dojo tree is all custom as far as event handling I would suggest putting a semi-transparent div overlay over the component which will give it the look of still being there but it will be somewhat grayed out and not accept events.

What you need for that is to inject and absolute positioned div into the child node with a known id. On that div set the opacity to maybe .25 and set the size to be that of the element containing the tree. You also want to make sure the z-index (css property) is higher than the tree but this should happen naturally if you create the node dynamically.

Would this strategy work better?

If you have a hard time with the JavaScript I can help work something out later today.

-Greg

castertroy
Offline
Joined: 2009-04-01
Points: 0

Hi Greg,

Thanks for taking your time. I was thinking there was a way to really disable the tree. This is a good work around though. Perhaps i should simply use this approach to disable dojo buttons and other widgets.

Regards,

Joseph