Alpha Video Training
Results 1 to 8 of 8

Thread: how to close all dynamic panels

  1. #1
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,832

    Default how to close all dynamic panels

    I am opening multiple dynamic panels on a PanelNavigator. I'd like to be able to close ALL of those dynamic panels without having to know the name/title of each. I am playing with saving and restoring the panel state with "<panelObject>.getState();" and that might work out.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  2. #2
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    344

    Default Re: how to close all dynamic panels

    I believe that you can dynamically get all the names/titles via:

    var arrayOfPanels = {dialog.object}.getPanelObject().panels;

    Then run through that array to get just the names of all the panels. Well actually, run through the array to get the names and some other key/value that allows you to filter out which panels that you added dynamically.

  3. #3
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,832

    Default Re: how to close all dynamic panels

    I could not find a way to get an array of open Dynamic panels or to Simply close any open panels. I'm toying now with the brute force method of simply refreshing the browser upon logout. That does work to close all of the Dynamic panels but I would prefer a softer solution.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

  4. #4
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    344

    Default Re: how to close all dynamic panels

    To tell you the truth, I'm not clear on what the term opening dynamic panels means.

    Do you mean programmatically adding and deleting (destroying) a couple of panel cards to a panel navigator
    or
    programmatically docking and hiding panel cards in a panel layout?

    Or panel overlays? Or panel overlays that are windows?
    Or container windows having a "panel" Sub-theme?

  5. #5
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,702

    Default Re: how to close all dynamic panels

    The problem is that Alpha doesn't give you any indication that a PanelCard is Dynamic. A property would have been nice.
    What does seem to be available is the panel name. A Dynamic PanelCare Name is a string 32 characters long.

    Get the PanelCard object with .getPanelObject()
    Get the panels property of that object... it will be an array.
    Loop through the panels testing the panels name property. If it has a length of 32 then you have a dynamic PanelCard.
    Remove it with pObj.removePanel()

    Remember that if you do this in a loop, your pObj will change - it's Dynamic PanelCards are no longer there... so you'll need to reduce your loop counter by 1.

    Or, loop through the panels array... and when you find a Dynamic PanelCard... add it's name to an array.
    Once done looping through panels array, then loop through your new array of Dynamic PanelCards, removing them.

    If you have named any non-Dynamic PanelCards with a name of 32 characters, then you're in trouble... so watch out for that.

  6. #6
    Member jgrannis's Avatar
    Real Name
    Jeff Grannis
    Join Date
    Apr 2016
    Location
    New Iberia, LA
    Posts
    344

    Default Re: how to close all dynamic panels

    When adding the panel cards programmatically, we could also prefix the panel name with something like: DynPanel_Group1_[panelID]
    Right?
    Then loop through removing the panels we want based on matching parts of the prefixes.

    Just an idea; I haven't tried it.

  7. #7
    "Certified" Alphaholic
    Real Name
    David Kates
    Join Date
    Apr 2008
    Location
    Unionville, ON
    Posts
    7,702

    Default Re: how to close all dynamic panels

    Yes... good idea Jeff. In that case you'd use the Dynamic PanelCard title... not the name. The name property is set by Alpha... I don't think you can get to it before it's created. It's a 32 character guid.

    But the title you get to set... so if you set it like "DP_ViewPDF1" and "DP_ViewPDF2" then you can just look for a panels title starting with "DP_"... and shove that panels name into an array for removal.

  8. #8
    Volunteer Moderator Steve Wood's Avatar
    Real Name
    Steve Wood
    Join Date
    Nov 2003
    Location
    Bay Area, California
    Posts
    8,832

    Default Re: how to close all dynamic panels

    Thanks, this is the script I ended up with:

    var pnObj = {dialog.object}.panelGet('PANELNAVIGATOR_1').panels;
    var arrayLength = pnObj.length;
    for(var i = 1;i < arrayLength;i++){
    {dialog.object}.panelRemove('PANELNAVIGATOR_1',pnObj[1].name);
    }


    Notes:

    - I had to get a pointer to my PanelNavigator where all of my DynamicPanels are set rather than just .getPanelObject().
    - I am running the panelRemove statement starting at 1 rather than 0 because the first panel is the "Dashboard" which I do not want to remove.
    - In the panelRemove statement I am always removing panel one because, as David said, the panel ID's drop by one each time a panel is removed. So I have to use 1 rather than the index variable i.
    Steve Wood
    Join the ALPHA DEVELOPERS NETWORK
    There is no Cloud. It's just someone else's computer.
    Web - Mobile - Hosting - Products - Frameworks - Developer Resources
    AlphaToGo | IADN (100% Alpha Anywhere Websites)

Similar Threads

  1. UI suggestions for dynamic lists, dynamic controls and immediate editing.
    By Steve Workings in forum Mobile & Browser Applications
    Replies: 50
    Last Post: 02-07-2017, 09:34 PM
  2. UX panels
    By carlbsmith in forum Mobile & Browser Applications
    Replies: 17
    Last Post: 02-15-2016, 08:58 PM
  3. Close Dynamic Panel
    By Gustavo1478 in forum Mobile & Browser Applications
    Replies: 7
    Last Post: 01-15-2016, 10:37 AM
  4. Can i prevent dialog window close, or capture the click on the close button?
    By WindForce in forum Application Server Version 11 - Web/Browser Applications
    Replies: 2
    Last Post: 11-26-2014, 04:39 AM
  5. Embedded UX in UX with panels
    By pcaspa in forum Mobile & Browser Applications
    Replies: 5
    Last Post: 06-12-2013, 10:11 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •