Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Initializing the same Splitter in two tabs
posted

Hello,

I'm trying to inizialize a splitter in more than one tab of my web application.

The tab loades its content via Ajax. The content of each tab is based on one template, which contains the splitter.

So every tab gets the same div-tag with the id "splitter" and should inizialize $("#splitter").igSplitter();

But when I open the second tab the debugger says "Error setting option". But I suppose the framework has problems to inizialize the new splitter with the same id as a still existing splitter object.

One possible solution is to clear the deactivated tabs' content. But I'm convinced, there is a nicer solution for this problem.

Has anyone a suggestion?

Regards, Lutz

Parents
No Data
Reply
  • 18204
    Suggested Answer
    Offline posted

    Hello Lutz,

     

    Thank you for posting in our forums!

    In general, the id for any element on your page should be unique from other elements.  jQuery depends on this.  You can see if you type $("#splitter").length in your console, jQuery only returns 1 element when using an ID as a selector.

    You can find more information on using the id attribute in the W3C specifications here:

    HTML 4.01: http://www.w3.org/TR/html4/struct/global.html#adef-id
    HTML5: http://www.w3.org/TR/html5/dom.html#the-id-attribute
    *Please note this site is not owned or maintained by Infragistics.

    What I would recommend is to add a class to your divs.  Something along the lines of: <div id="splitter1" class="splitterContainer"> and <div id="splitter2" class="splitterContainer">.

    Then, you can use the following code to create and reference the igSplitters by their class:

    $(".splitterContainer").igSplitter(...);

    This will return matching selectors, which in this case would be both splitters and initialize them with the igSplitter.

    If you have any further questions or concerns with this, please let me know.

Children