Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Events for SectionStacks?

    Hi, I'm using SmartClient JS 7.0rc2 and am wondering if there are any events that occur for SectionStacks.

    I have an SectionStack with multiple sections and their headers. In these headers I have some controls (buttons). I want only one section to be visible at one time (visibilityMode: 'mutex') and once that section is visible it should show the buttons, else they should be hidden. Besides that I want to fetch data for a grid in the active (visible) section. I want this to happen only when the section gets expanded, but can't find any methods helping me out with this.

    #2
    Since I have no reply yet, I will write what I have now discovered. I've created a show method on each grid in the Section Stack. As soon as it gets shown, I call a grid.fetchData() and the super method of "show". This works, but I've also tried to show/hide controls buttons of inactive section stacks and then I have problems with buttons being shown too soon.

    I've attached an image of the section stack. I want to have only the control buttons of the active section stack visible (now they are disabled, which is less nice).
    Attached Files

    Comment


      #3
      Hi Wallytax,
      Without seeing a standalone example it's hard to comment exactly on your use case. However, it sounds like you could override expandSection() and collapseSection() to get a notification when the user changes the view -- these methods will be fired when the user clicks on the section headers to expand / collapse sections.

      Comment


        #4
        Not having tried out your suggestion (yet), reading this seems it will be the solution! But let me ask one more question in general then, which could help others as well.

        Reading the reference guide for these methods makes me think I could use it to collapse/expand sections, but I (personally) would not have thought about overriding it to add my own code, which is what you suggest, isn't it?

        My point is that it isn't always clear how one could use the reference guide. It looks like you need to call these methods, but now it turns out that they are actually used internally (at least, when I read your comment). The docs say:

        Collapse a section or sections. This action hides all the items assigned to the section. Calling this method is equivalent to the user clicking on the SectionHeader of an expanded section.
        But it's not clear this is used internally as well and thus suitable for "plugging in" custom code. Do you get my point?

        Comment


          #5
          Yup, noted.
          In this case the method works both ways - it can be called directly and it's also used internally to react to the user clicking on the section headers.

          We've updated the docs for these methods to make this more obvious.

          Comment

          Working...
          X