We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Strange behaviour

When using the accordion and setting it to .EnableMultipleOpen() and then enabling an already enabled item causes that item to close and then open again when clicking on it once.
This can be replicated by using the sample: http://mvc.syncfusion.com/demos/web/accordion/methods   
and then just adding the EnableMultipleOpen option.

1 Reply

RM Ragunath M Syncfusion Team May 29, 2015 03:18 PM UTC

Hi Thomas 
Thanks for using Syncfusion products 
Query: enabling an already enabled item causes that item to close and then open again when clicking on it once in Accordion 
This is default behavior of our accordion controls. When we enable multiple open property then click the unexpanded item it will opens the clicked item without hiding previously opened item. Also when we click the opened item it will close the corresponding item. When we restrict the close behavior we unable to hide the already opened item. To prevent the closing we suggest you to use below workaround.  Workaround should be added under the create event of the accordion. 
Please prefer the below code snippet: 
<code> 
[CSHTML]

@Html.EJ().Accordion("basicAccordion").ClientSideEvents(evt => evt.Create("onCreate")).EnableMultipleOpen(true).Items(data =>

               {

                   data.Add().Text("Essential Chart").ContentTemplate(@<div>

                   Essential Chart for ASP.NET MVC is a visually stunning, high-performance charting component that is easy to use.

                                    It includes 35 chart types ranging from simple column charts to specialized financial charts.

                                    The charts are highly customizable and have a powerful data model that makes data binding simple.                   

               </div>);

                   data.Add().Text("Essential Schedule").ContentTemplate(@<div>

                       Essential Schedule for ASP.NET MVC is an Outlook Calendar-like scheduler control that lets you add rich scheduling capabilities to your web applications.

                                    It includes an advanced set of features including data binding, multiple resource views, rich interactivity, support for AJAX, client-side events, and much more.

                   </div>);

                   data.Add().Text("Essential Grid").ContentTemplate(@<div>Essential Grid for ASP.NET MVC is a feature-rich control that provides extensive appearance customization options with support for grouped records. With Essential Grid for ASP.NET MVC, you can create a grid with a highly customizable look and feel. This grid is very useful for generating complex grid-based reports with rich formatting. It supports paging, sorting, grouping, filtering, and editing features. It also supports a JSON mode in which you can handle all the operations like paging and sorting. The performance of these operations in the JSON mode will be much faster than if the grid were to handle them. Essential Grid generates clean HTML in compliance with XHTML 1.0. It supports any kind of IEnumerable data source. It uses LINQ data retrieval techniques for handling data sources, and offers high performance.</div>);
               })     
[JS]

function onCreate() {

        var accObj = $("#basicAccordion").data("ejAccordion");       

        accObj._off($("#basicAccordion").find("h3").first(),"click");
    } 
</code> 
Note: This workaround restrict the click event of first item in accordion.   
We have prepared simple sample based on the requirement and which is available in below location:
http://www.syncfusion.com/downloads/support/forum/119256/ze/Accordian241362752 
Regards,
Ragunath M


Loader.
Live Chat Icon For mobile
Up arrow icon