Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Close child accordion content when click another parent accordion header. #25

Closed
shaohaolin opened this issue Sep 30, 2015 · 2 comments
Closed

Comments

@shaohaolin
Copy link

I have 2 levels accordions. I want to collapse the level 2 content when I click level 1 accordion header.

Is it a way I can do that ? Thank you.

accordionpage

Basically, what I mean is:

When I click Pane 2, the content of SubPane 1 will collapse.

@shaohaolin shaohaolin changed the title Closed nested accordion when click another parent accordion header. Closed child accordion content when click another parent accordion header. Sep 30, 2015
@shaohaolin shaohaolin changed the title Closed child accordion content when click another parent accordion header. Close child accordion content when click another parent accordion header. Sep 30, 2015
@LukaszWatroba
Copy link
Owner

LukaszWatroba commented Oct 29, 2015

Hey.

Hmm, I'm not 100% sure, but something like this should do the trick:

<v-accordion multiple control="myAccordion" onexpand="expandCb(index, id)">
  <v-pane id="myPane1">
    <v-pane-header>
      First pane header
    </v-pane-header>

    <v-pane-content>
      First pane content
    </v-pane-content>
  </v-pane>

  <v-pane id="myPane2">
    <v-pane-header>
      Second pane header
    </v-pane-header>

    <v-pane-content>
      Second pane content

      <v-accordion multiple control="mySubAccordion">
        <v-pane id="mySubPane1">
          <v-pane-header>
            First subpane header
          </v-pane-header>

          <v-pane-content>
            First subpane content
          </v-pane-content>
        </v-pane>
      </v-accordion>
    </v-pane-content>
  </v-pane>
</v-accordion>
myApp.controller('myAccordionController', function ($scope) {
  $scope.expandCb = function (index, id) {
    if (id === 'pane1') {
      $scope.mySubAccordion.collapse('mySubPane1');
    }
  };
});

You need to download the latest release first. If you are still interested of course.
Sorry for the late reply!

@shaohaolin
Copy link
Author

@LukaszWatroba Thanks for the reply. I found a way to walk around :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants