jQWidgets Forums
jQuery UI Widgets › Forums › Layouts › Docking › Remove completely a window when closed
Tagged: docking, jqxDocking
This topic contains 3 replies, has 3 voices, and was last updated by wavetrex 12 years, 3 months ago.
-
Author
-
Hello,
I want to completely remove the window on close.
What I did now was attach an event handler to the close button,
make may server calls,
remove it from the DOM
close it via close window.
but when I look at the exportLayout the windows are still there, under a floating element.$('.jqx-window-close-button').live('click', function (event) { var widgetIdToDelete = $(this).closest('.WidgetWindow').attr('id') dockingVm.removeWidget(widgetIdToDelete); });
The code :
$('.jqx-window-close-button').live('click', function (event) { var widgetIdToDelete = $(this).closest('.WidgetWindow').attr('id') //some server calls here $('#docking').jqxDocking('closeWindow', widgetIdToRemove); $('#' + widgetIdToRemove).remove(); });
My export layout the ends up like this after deleteing all the widgets:
{“panel0″: {},”panel1″: {},”panel2″: {},”floating”:{“fe0cf038-2bac-a9b6-fbf1-4e17315fd96b”:{“x”:”863px”,”y”:”325px”,”width”:”undefined”,”height”:”undefined”,”collapsed”:undefined},”cd35773f-5753-7e11-46d5-6090e7091d88″:{“x”:”583px”,”y”:”406px”,”width”:”undefined”,”height”:”undefined”,”collapsed”:undefined},”bb221b9d-4288-184f-9b6f-a0a362d5cf3e”:{“x”:”310.5px”,”y”:”123.5px”,”width”:”undefined”,”height”:”undefined”,”collapsed”:undefined}},”orientation”: “horizontal”}
But I don’t want the floating part!
Hi pimboden,
I am sorry about the inconvenience. At present, the jqxDocking exports what’s initialized. Removed windows are exported, too. I will of course create a work item about this issue and we will do our best to resolve it in the next release.
Best Wishes,
Peter StoevjQWidgets Team
http://www.jqwidgets.comI have a rather simple solution to this, and used it in the application I’m building.
1. Use functions on events (close, open) to set another variable (for example an object containing the ID’s of the windows, when removing one, remove it from the accessory object as well.
2. When saving the state in your database, compare with the accessory object and remove the now closed windows from the JSON
That’s about it.
-
AuthorPosts
You must be logged in to reply to this topic.