Revision history [back]

click to hide/show revision 1
initial version

asked 2012-09-06 12:47:01 +0800

szarza gravatar image szarza

http://balteus.blogspot.c...

Using databinding in menupopup

Hello: I have a templated tree with several treechildren depending on node type. Each node has its own context menu. I want disable some options depending on node status, but I can't use databinding (like @load()) in menupopup becouse it is outside of the template (I suppose).

This is what I have

                    <tree id="tree" width="100%" height="100%" hflex="1"
                        zclass="z-dottree" style="border: 0px"
                        onSelect="@command('select')"
                        model="@load(vm.tree) @template(each.data.type)" vflex="true">
                        <template name="JDialerAdmin" var="node">
                            <treeitem context="jdialerMenu"
                                value="@load(node.data)">
                                <treerow>
                                    <treecell
                                        label="@load(node.data.name)" image="/image/kservices.png"
                                        tooltiptext="@load(node.data.description)" />
                                </treerow>
                            </treeitem>
                        </template>
                        <template name="Service" var="node">
                            <treeitem context="serviceMenu"
                                value="@load(node.data)">
                                <treerow>
                                    <treecell
                                        label="@load(node.data.name)"
                                        image="@load(node.data.data.on ? '/image/player_play.png' : '/image/player_stop.png')"
                                        tooltiptext="@load(node.data.description)" />
                                </treerow>
                            </treeitem>
                        </template>
                        <template name="Campaign" var="node">
                            <treeitem context="campaignMenu"
                                value="@load(node.data)">
                                <treerow>
                                    <treecell
                                        label="@load(node.data.name)" image="/image/kded.png"
                                        tooltiptext="@load(node.data.description)" />
                                </treerow>
                            </treeitem>
                        </template>
                        <template name="Charge" var="node">
                            <treeitem context="chargeMenu"
                                value="@load(node.data)">
                                <treerow>
                                    <treecell
                                        label="@load(node.data.name)" image="/image/db.png"
                                        tooltiptext="@load(node.data.description)" />
                                </treerow>
                            </treeitem>
                        </template>
                    </tree>
                    <menupopup id="jdialerMenu">
                        <menuitem label="Añadir servicio"
                            image="/image/add.png" onClick="@global-command('addService')" />
                        <menuseparator />
                        <menuitem label="Monitorizar agentes"
                            image="/image/users_info.png" />
                    </menupopup>
                    <menupopup id="serviceMenu">
                        <menuitem label="Añadir campaña"
                            image="/image/add.png" onClick="@global-command('addCampaign')" />
                        <menuseparator />
                        <menuitem label="Iniciar servicio"
                            image="/image/player_play.png" />
                        <menuitem label="Parar servicio"
                            image="/image/player_stop.png" />
                        <menuitem label="Eliminar servicio"
                            image="/image/cross.png"
                            onClick="@global-command('deleteServices')" />
                    </menupopup>
                    <menupopup id="campaignMenu">
                        <menuitem label="Añadir carga"
                            image="/image/add.png" onClick="@global-command('addCharge')" />
                        <menuitem label="Eliminar campaña"
                            image="/image/cross.png"
                            onClick="@global-command('deleteCampaigns')" />
                    </menupopup>
                    <menupopup id="chargeMenu">
                        <menuitem label="Eliminar carga"
                            image="/image/cross.png"
                            onClick="@global-command('deleteCharges')" />
                    </menupopup>

I want to add dinamical behaviour to menupopup using databinding like this: disable="@load(node.data.data.on)", but it doesn't work. i.e.:

                    <menupopup id="serviceMenu">
                        <menuitem label="Añadir campaña"
                            image="/image/add.png" onClick="@global-command('addCampaign')" />
                        <menuseparator />
                        <menuitem label="Iniciar servicio"
                            image="/image/player_play.png" disable="@load(node.data.data.on)"/>
                        <menuitem label="Parar servicio"
                            image="/image/player_stop.png" disable="@load(not node.data.data.on)"/>
                        <menuitem label="Eliminar servicio"
                            image="/image/cross.png"
                            onClick="@global-command('deleteServices')" />
                    </menupopup>

Anybody knows how? Thanks,

Using databinding in menupopup

Hello: I have a templated tree with several treechildren depending on node type. Each node has its own context menu. I want disable some options depending on node status, but I can't use databinding (like @load()) in menupopup becouse it is outside of the template (I suppose).

This is what I have

 <tree id="tree" width="100%" height="100%" hflex="1"
     zclass="z-dottree" style="border: 0px"
     onSelect="@command('select')"
     model="@load(vm.tree) @template(each.data.type)" vflex="true">
     <template name="JDialerAdmin" var="node">
         <treeitem context="jdialerMenu"
             value="@load(node.data)">
             <treerow>
                 <treecell
                     label="@load(node.data.name)" image="/image/kservices.png"
                     tooltiptext="@load(node.data.description)" />
             </treerow>
         </treeitem>
     </template>
     <template name="Service" var="node">
         <treeitem context="serviceMenu"
             value="@load(node.data)">
             <treerow>
                 <treecell
                     label="@load(node.data.name)"
                     image="@load(node.data.data.on ? '/image/player_play.png' : '/image/player_stop.png')"
                     tooltiptext="@load(node.data.description)" />
             </treerow>
         </treeitem>
     </template>
     <template name="Campaign" var="node">
         <treeitem context="campaignMenu"
             value="@load(node.data)">
             <treerow>
                 <treecell
                     label="@load(node.data.name)" image="/image/kded.png"
                     tooltiptext="@load(node.data.description)" />
             </treerow>
         </treeitem>
     </template>
     <template name="Charge" var="node">
         <treeitem context="chargeMenu"
             value="@load(node.data)">
             <treerow>
                 <treecell
                     label="@load(node.data.name)" image="/image/db.png"
                     tooltiptext="@load(node.data.description)" />
             </treerow>
         </treeitem>
     </template>
 </tree>
 <menupopup id="jdialerMenu">
     <menuitem label="Añadir servicio"
         image="/image/add.png" onClick="@global-command('addService')" />
     <menuseparator />
     <menuitem label="Monitorizar agentes"
         image="/image/users_info.png" />
 </menupopup>
 <menupopup id="serviceMenu">
     <menuitem label="Añadir campaña"
         image="/image/add.png" onClick="@global-command('addCampaign')" />
     <menuseparator />
     <menuitem label="Iniciar servicio"
         image="/image/player_play.png" />
     <menuitem label="Parar servicio"
         image="/image/player_stop.png" />
     <menuitem label="Eliminar servicio"
         image="/image/cross.png"
         onClick="@global-command('deleteServices')" />
 </menupopup>
 <menupopup id="campaignMenu">
     <menuitem label="Añadir carga"
         image="/image/add.png" onClick="@global-command('addCharge')" />
     <menuitem label="Eliminar campaña"
         image="/image/cross.png"
         onClick="@global-command('deleteCampaigns')" />
 </menupopup>
 <menupopup id="chargeMenu">
     <menuitem label="Eliminar carga"
         image="/image/cross.png"
         onClick="@global-command('deleteCharges')" />
 </menupopup>

I want to add dinamical behaviour to menupopup using databinding like this: disable="@load(node.data.data.on)", but it doesn't work. i.e.:

 <menupopup id="serviceMenu">
     <menuitem label="Añadir campaña"
         image="/image/add.png" onClick="@global-command('addCampaign')" />
     <menuseparator />
     <menuitem label="Iniciar servicio"
         image="/image/player_play.png" disable="@load(node.data.data.on)"/>
     <menuitem label="Parar servicio"
         image="/image/player_stop.png" disable="@load(not node.data.data.on)"/>
     <menuitem label="Eliminar servicio"
         image="/image/cross.png"
         onClick="@global-command('deleteServices')" />
 </menupopup>

Anybody knows how? Thanks,

Using databinding in menupopup

Hello: I have a templated tree with several treechildren depending on node type. Each node has its own context menu. I want disable some options depending on node status, but I can't use databinding (like @load()) in menupopup becouse it is outside of the template (I suppose).

This is what I have

<tree id="tree" width="100%" height="100%" hflex="1"
    zclass="z-dottree" style="border: 0px"
    onSelect="@command('select')"
    model="@load(vm.tree) @template(each.data.type)" vflex="true">
    <template name="JDialerAdmin" var="node">
        <treeitem context="jdialerMenu"
            value="@load(node.data)">
            <treerow>
                <treecell
                    label="@load(node.data.name)" image="/image/kservices.png"
                    tooltiptext="@load(node.data.description)" />
            </treerow>
        </treeitem>
    </template>
    <template name="Service" var="node">
        <treeitem context="serviceMenu"
            value="@load(node.data)">
            <treerow>
                <treecell
                    label="@load(node.data.name)"
                    image="@load(node.data.data.on ? '/image/player_play.png' : '/image/player_stop.png')"
                    tooltiptext="@load(node.data.description)" />
            </treerow>
        </treeitem>
    </template>
    <template name="Campaign" var="node">
        <treeitem context="campaignMenu"
            value="@load(node.data)">
            <treerow>
                <treecell
                    label="@load(node.data.name)" image="/image/kded.png"
                    tooltiptext="@load(node.data.description)" />
            </treerow>
        </treeitem>
    </template>
    <template name="Charge" var="node">
        <treeitem context="chargeMenu"
            value="@load(node.data)">
            <treerow>
                <treecell
                    label="@load(node.data.name)" image="/image/db.png"
                    tooltiptext="@load(node.data.description)" />
            </treerow>
        </treeitem>
    </template>
</tree>
<menupopup id="jdialerMenu">
    <menuitem label="Añadir servicio"
        image="/image/add.png" onClick="@global-command('addService')" />
    <menuseparator />
    <menuitem label="Monitorizar agentes"
        image="/image/users_info.png" />
</menupopup>
<menupopup id="serviceMenu">
    <menuitem label="Añadir campaña"
        image="/image/add.png" onClick="@global-command('addCampaign')" />
    <menuseparator />
    <menuitem label="Iniciar servicio"
        image="/image/player_play.png" />
    <menuitem label="Parar servicio"
        image="/image/player_stop.png" />
    <menuitem label="Eliminar servicio"
        image="/image/cross.png"
        onClick="@global-command('deleteServices')" />
</menupopup>
<menupopup id="campaignMenu">
    <menuitem label="Añadir carga"
        image="/image/add.png" onClick="@global-command('addCharge')" />
    <menuitem label="Eliminar campaña"
        image="/image/cross.png"
        onClick="@global-command('deleteCampaigns')" />
</menupopup>
<menupopup id="chargeMenu">
    <menuitem label="Eliminar carga"
        image="/image/cross.png"
        onClick="@global-command('deleteCharges')" />
</menupopup>

I want to add dinamical behaviour to menupopup using databinding like this: disable="@load(node.data.data.on)", but it doesn't work. i.e.:

<menupopup id="serviceMenu">
    <menuitem label="Añadir campaña"
        image="/image/add.png" onClick="@global-command('addCampaign')" />
    <menuseparator />
    <menuitem label="Iniciar servicio"
        image="/image/player_play.png" disable="@load(node.data.data.on)"/>
    <menuitem label="Parar servicio"
        image="/image/player_stop.png" disable="@load(not node.data.data.on)"/>
    <menuitem label="Eliminar servicio"
        image="/image/cross.png"
        onClick="@global-command('deleteServices')" />
</menupopup>

Anybody knows how? Thanks,

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More