detach/attach

Hi all.
Have following js problem:

  1. mytree = layout.cells(“a”).attachTree(); → ok
  2. layout.cells(“a”).detachObject(); → ok, as far as i know the dom node was moved to document.body
  3. but now: how can i reattach mytree to cell(“a”) ?

→ layout.cells(“a”).attachObject(mytree) – doesn’t work.
A JS DOM childNode error is thrown (ok, mytree is an object not a dom element)

Can s.o. help me out please??
Yes i know, js basisc :slight_smile:
Regards,
Alexander

Hi
Why exactly reattach? Could you specify?
You can resresh this tree.

Hi Darya .
Probably you mean refresh.

The situation is that i have to lock the screen.
The main application consists of a menubar, a tree left and working space in center (2U pattern)
Locking the screen needs to switch to 1C showing only a login window prompt.
Relogin falls back to 2U.
Thats one situation.

Another situation is when the tree within the main application should be hidden.
Therefore the whole cell the tree resides in should be deattached.

Thats the situation.

Another problem i have is: how can i make the whole menubar inactive when user has
locked the screen and a login prompt (form) is shown within a window? Ok, a modal window.
But do you imagine a way solution to lock the menubar by script?

Regards,
Alexander

Yes, i meant REFRESH. Sorry :slight_smile:
I guess you need such simple feature like views:
dhtmlx.com/docs/products/dht … views.html
In this case you don’t need reattach anything, just switch views!

About menu: all the menu items can be disabled.
docs.dhtmlx.com/doku.php?id=dhtm … emdisabled
Especially, if you will use views, you can attach yout disabled menu to your “disabled” view.

Ok, don’t like views as they cause a new app level but will use them.
Thats ok for me.

Beside i would be very very pleased if you had an closing answer for me respective the mentioned js error. I’m not really firm with js and dom i could learn s.th…

An detached object resides as an node below document.body.
Thats what i’ve read so far.
What would be the right way to get them back to the view?

attachObject() takes a dom selector string or an getElementBy…-object.
Whats the difference between the getElementBy…-object and the object
residing under document.body when i have an pointer (variable) linked to this node ?

I’m confused … :slight_smile:

Best wishes,
Alexander

Just tried views but don’t really get it done.
Needed is a global switch from 2U (workplace) to 1C (logon) - and backwards.

Views only work on cell level as i see.
When i understand right a way would be:

var screen = new dhtmlXLayoutObject(document.body, “1C”);
screen.attachMenu(); --> OK

var log = new dhtmlXLayoutObject(screen.cells("a").view("logon"), "1C");

	log.attachMenu();  --> menu is attached to screen object

var wp = new dhtmlXLayoutObject(screen.cells("a").view("workplace"), "2U");

	wp.attachMenu();  --> menu is attached to screen object

screen.cells(“a”).view(“workplace”).setActive(); --> works fine

As i marked there is a basic problem when attaching the menues to the correct views.

My fault?

Attach a sample for you baced on your issue.
layout_views.rar (156 KB)

Great!!
Seems to be the same.
Yours works fine, mine needs some kind of correction i think :slight_smile:

:wink:

You are welcome! :slight_smile:

Yes! Tested it.
Thats what i wanted for layout.
Thank you very very much.

:slight_smile: