Xpages:具有属性组和多个实例的自定义控件

时间:2016-05-27 16:22:54

标签: xpages

构建菜单自定义控件,无法获取具有多个实例的属性组。

我的cc代码是:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xe="http://www.ibm.com/xsp/coreex">

    <xe:navigator id="navigator1"
        styleClass="nav nav-pills nav-stacked">
        <xe:this.treeNodes>     
            <xe:repeatTreeNode indexVar="index" var="entry"
                value="#{javascript:compositeData.menuItemGroup}">
                <xe:this.children>
                    <xe:pageTreeNode
                        label="#{javascript:entry.menuName}">
                    </xe:pageTreeNode>
                </xe:this.children>
            </xe:repeatTreeNode>
        </xe:this.treeNodes>
    </xe:navigator> 
</xp:view>

我的Xpage代码是:

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core"
    xmlns:xc="http://www.ibm.com/xsp/custom"
    xmlns:xe="http://www.ibm.com/xsp/coreex">

            <xc:cc_CommonMenu xp:key="facetMenu" menuTitle="PCs">
                <xc:this.menutItemGroup>
                    <xc:menutItemGroup menuName="First Menu Item"
                        menuTarget="/firstMenuItem">
                    </xc:menutItemGroup>
                    <xc:menutItemGroup menuName="Second Menu Item"
                        menuTarget="/secondMenuItem">
                    </xc:menutItemGroup>
                </xc:this.menutItemGroup>
            </xc:cc_CommonMenu>
</xp:view>

我怀疑通过阅读数据结构可能更容易做到这一点similar to this post

1 个答案:

答案 0 :(得分:1)

这只是一个小错字。

您的属性组名为$(source).handleServerEvents({ handlers: { logout: function (msg) { //Show AngularJS dialog $mdDialog.alert({ title: 'Attention', textContent: msg, ok: 'Close' }); }, //... Other custom handlers } }); - “menu”和“ItemGroup”之间带有“t”。

将自定义控件中的代码更改为

menutItemGroup

(“menu”和“ItemGroup”之间带有“t”),它将起作用。

相关问题