0

popup dynamic menu performance

asked 2019-05-08 18:30:54 +0800

AndreyK gravatar image AndreyK
151

Hello! Anyone worked with big dynamic popup menu? It take many time for ZK when we get many elements. For this structure (below) it can take 10+ mins for 600 combined elements. ZK have instruments for improve performance or what can be done?

<menu label="Put data"
    visible="@load(vm.ownMu)" image="/images/documents.png">
    <menupopup
        children="@bind(vm.reportModel) @template(each.childCount eq 0?'menuitem':'menu')">
        <template name="menu" var="menu">
            <menu label="@bind(menu.name)"
                visible="@load(menu.visible)">
                <menupopup
                    children="@bind(menu.children) @template(each.childCount eq 0?'menuitem':'menu')" />
            </menu>
        </template>
        <template name="menuitem" var="item">
            <menuitem
                label="@bind(item.report ? ''.concat(item.reportData.idreport).concat('. ').concat(item.reportData.shortnamereport):item.name)"
                onClick="@command(item.report ? 'reportClicked' : '', node=item.reportData)"
                image="@bind(item.report ? '/images/Excel-16.gif' : '')"
                disabled="@load(not vm.reader)" visible="@load(item.visible)" />
        </template>
    </menupopup>
</menu>
delete flag offensive retag edit

Comments

First thing i would do is use @init or @load in stead of the @bind where it's not needed. It produces more overhead

chillworld ( 2019-05-14 02:34:32 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-05-09 12:07:17 +0800

hawk gravatar image hawk
2335 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2019-05-09 12:08:11 +0800

I try to create 600 menuitems in a menupop, it takes a bit longer (12s) to load that pages. My example is based on An example of dynamic menu bar in http://books.zkoss.org/zk-mvvm-book/8.0/databinding/childrenbinding.html image description

According to developer tool, the page loading time is bit longer but menu popup shows in a blink. image description

So which action takes 10 min? loading a page or pop up a menu? If loading pages takes long, I suggest you do a server profiling to know which method takes the most of time.

link publish delete flag offensive edit

Comments

Yes, I did some template. But if this more complex more time. You made only 1 lvl and got 12s. Did you try 4-5 lvls and, for example, only 10 branches on first drop? 600+ menuitems and around 100 menu ?

AndreyK ( 2019-05-22 18:58:36 +0800 )edit

First, I get model with entities from a database, then works only ZK. If menu small it fast, if big, I get disproportionate increase in time. Have no idea how ZK create this component. Will try other ways

AndreyK ( 2019-05-22 18:58:48 +0800 )edit
0

answered 2019-05-23 09:55:54 +0800

hawk gravatar image hawk
2335 1 5
http://hawkphoenix.blogsp... ZK Team

updated 2019-05-23 09:56:19 +0800

Could be a children binding issue. Could you replace it with shadow <forEach>?

Ref: * http://books.zkoss.org/zkessentials-book/master/shadowcomponents/iteratea_collection.html

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
3 followers

RSS

Stats

Asked: 2019-05-08 18:30:54 +0800

Seen: 15 times

Last updated: 17 hours ago

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