Preserving open state of Projects

Hi there,

I want to preserve the open state of projects. What’s the best way to do that?
Basically if someone opens up a project, on page reload I want that to still be open.

    gantt.attachEvent "onTaskOpened", (id) ->
      gantt.updateTask(id)

    gantt.attachEvent "onTaskClosed", (id) ->
      gantt.updateTask(id)

However, the task doesn’t send the $open attribute to the server. How do I go about doing this?

Thanks!

Hi,
Do you want to save changes into DB? I.e. if the project will be opened on another PC, you’ll have the same opened/closed tasks? Will it be ok, if many people work with a project at the same time? One user opens the branch, then reload page and at the same time another user close this branch.
If you prefer this case you should save ‘open’ property. Catch event when a brach is opened or closed, then set

event.open = true

or

event.open = false

and call updateTask to save changes. The new ‘open’ value will be applied while loading.

If you want to save locally - also, try to save to local storage hash open value {taskId: true/false} when onTaskOpen/onTaskClose fire. And set this value to “event.open” when onTaskLoading fire.