Programmatically Expand section header

Forums Requests Programmatically Expand section header

This topic contains 3 replies, has 2 voices, and was last updated by  Alexander Bautz 2 weeks ago.

  • Author
    Posts
  • #21309

    Pat
    Participant

    I have a workflow form and the user is asking that based on a dropdown value, a specific section would appear. I have this part working using DFFS, Rules, Tabs and some custom JS. What I would like to have happen is that not only does the section appear with the plus sign but that it automatically (programmatically) expands and changes the + sign to the – sign. Is this available within SharePoint/DFFS?
    See the snapshot attached. In this snippet, when I select 2 from the dropdown. I can make the +Model1 and +Model2 sections appear but would like them to appear expanded.

    Any suggestions gratefully accepted. Thanks

    Attachments:
  • #21314

    Alexander Bautz
    Keymaster

    Hi,
    Do you use the “Expand / collapse” settings on the headings in the form – configured in the Tabs?

    If so, you can expand it like this in Custom JS:

    jQuery("#dffsHeading_header_number_1 .dffs_headingOrHTMLWrap").trigger("click");

    Replace “header_number_1” with the unique id of your header section.

    Alexander

  • #21330

    Pat
    Participant

    Alex, this worked like a charm. Thanks so much. Is there also a quick way to tell whether a section is expanded or collapsed?

  • #21346

    Alexander Bautz
    Keymaster

    You can use this object to check if it is expanded:

    spjs.dffs.data.accordion.expanded["dffsHeading_header_number_1"]

    It will return true for expanded and false for collapsed headings. Replace “header_number_1” with your heading unique id.

    Alexander

You must be logged in to reply to this topic.