0

Fill Navbar with MVVM

asked 2014-08-03 05:58:26 +0800

elmetni gravatar image elmetni
145 7

hello everyone

i am working on a project using ZK , what i want to do now is to create a menu using Navbar componant from a List from my ViewModel .

but i didnt know how to do it , can u help me pls with an exemple?

delete flag offensive retag edit

4 Answers

Sort by ยป oldest newest most voted
1

answered 2014-08-03 11:24:27 +0800

Darksu gravatar image Darksu
1991 1 4

Hello elmetni,

In order to create a menu component from a list, you can use the following code below:

<window border="none"
        xmlns:n="native"
        id="mainWin"        
        width="100%">

    <zscript>
        navMenuItems = new String[] {"Home", "Get Started", "About"};                            
    </zscript>

 <navbar forEach="${navMenuItems}" orient="vertical" width="200px">
        <navitem label="${each}" iconSclass="z-icon-home" />                
    </navbar>

</window>

If you wish to load it from a controller, then set an id to the navbar, wire it with the controller, and apply the model to the navbar.

Best Regards,

Darksu

link publish delete flag offensive edit

Comments

thank you :)

elmetni ( 2014-08-03 16:54:38 +0800 )edit
0

answered 2015-02-09 22:47:23 +0800

intoxicadocoder gravatar image intoxicadocoder
57 1 1 3

updated 2015-02-11 11:57:17 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...
<navbar orient="vertical" zclass="none"
        class="navbar-collapse collapse" children="@load(vm.itemsModel)" >
     <template name="children" var="item">
        <nav label="@load(item.nombre)" style="text-transform:capitalize;"
             children="@load(item.hijos)">
            <template name="children" var="child">
                <navitem label="@load(child.nombre)"
                         onClick="@command('loadModulo',comp=self,param=child)"/>
            </template>
        </nav>
    </template>
</navbar>
link publish delete flag offensive edit
0

answered 2015-02-10 07:54:31 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India
2615 3 8
http://emrpms.blogspot.in...

Here is an example

link publish delete flag offensive edit
0

answered 2015-02-11 11:53:34 +0800

warzau gravatar image warzau
1
http://inwestycjezglowa.c...

great example!

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2014-08-03 05:58:26 +0800

Seen: 71 times

Last updated: Feb 11 '15

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