collapse/expand C1Expander using JQuery

Posted by: kaytea on 10 September 2017, 11:42 am EST

  • Posted 10 September 2017, 11:42 am EST

    Hi,

    How do I collapse or expand C1Expander using JQuery? I am trying to collapse or expand all C1Expanders via a click on a link.

    var currentBehavior = null;
    var allBehaviors = Sys.Application.getComponents();
    for (var loopIndex = 0; loopIndex < allBehaviors.length; loopIndex++) {
    currentBehavior = allBehaviors[loopIndex];
    var exp = new RegExp("PnlOption");
    var match = exp.exec(currentBehavior.get_id());
    if (match && match.length > 0) {
    //currentBehavior.set_Collapsed(collapse);
    currentBehavior.attr('Expanded', collapse);
    }
    }


    Thanks.
  • Replied 10 September 2017, 11:42 am EST

    Hi kaytea,

    You can collapse all the C1Expanders via a click using the following jQuery code :

    function btn_click(sender, args) {

    $(".wijmo-wijexpander").each(function (index, elem) {

    $(elem).c1expander({ expanded: false });

    });

    }


    wijmo-wijexpander is the name of the class that C1Expander uses.

    If you wish to collapse a specific C1Expander with id 'C1Expander1', you can replace the above code with :

    function btn_click(sender, args) { 

    $("#C1Expander1").c1expander({ expanded: false });

    }


    Hope it helps!

    Warm Regards
  • Replied 10 September 2017, 11:42 am EST

    Hi,
    My C1 version is 4.0.20111.201 which is not wijmo. The above code did not work and gave the following error: "Microsoft JScript runtime error: Object doesn't support this property or method."

    Thanks!
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels