Can I open a specific entry in a dojo accordion?

◇◆丶佛笑我妖孽 提交于 2019-12-24 05:59:48

问题


I want to put links in the left navigation of my application that open an xPage and select a specific accordion entry. Not sure how to do this

Any thoughts?


回答1:


I am assuming here that you want to do this programmatically. Look into this answer- https://stackoverflow.com/a/1190455/1047998 - which describes the usage of selectChild which is used to select specific accordion pane. You can also go through the Dojo API documentation of dijit.layout.AccordionContainer - http://dojotoolkit.org/api/1.6/dijit/layout/AccordionContainer - where you can refer the documentation for selectChild.

Update:

So let's say if you define your accordion container like this:

<xp:div dojoType="dijit.layout.AccordionContainer" id="accordionContainer">
    <xp:div dojoType="dijit.layout.ContentPane" id="pane1" title="Pane 1">
        Content 1
    </xp:div>
    <xp:div dojoType="dijit.layout.ContentPane" title="Pane 2" id="pane2">
        Content 2
    </xp:div>
    <xp:div dojoType="dijit.layout.ContentPane" title="Pane 3" id="pane3">
        Content 3
    </xp:div>
    <xp:div dojoType="dijit.layout.ContentPane" title="Pane 4" id="pane4">
        Content 4
    </xp:div>
</xp:div>

So to select pane3 JavaScript code would be like:

var ac = dijit.byId("#{id:accordionContainer}");
ac.selectChild(dijit.byId("#{id:pane3}"));


来源:https://stackoverflow.com/questions/16641668/can-i-open-a-specific-entry-in-a-dojo-accordion

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!