How to hide Navigation Sidebar

how to hide Navigation Sidebar by using function node?

image

You cannot.
Function nodes run server side (in the nodejs runtime)
Dashboard runs client side (in a remote browser)

What you could probably do:

  • write a ui-template that handles messages on input
  • wire an msg input into the ui-template
  • In t he template code:
    • if the msg.topic (or payload or whatever) matches some criteria you determine means "close the sidebar), simulate a click on the menu element (not tested, not guaranteed to work)
    • You will also need to inspect the menu elements and figure out what classes/props/attributes identify it as being open before sending a click event to avoid getting out-of-step

If you need this level of feature built in, then please raise an issue on the dashboard repository. I suspect this would be somthing that ui_control would have to have programmed support for.