0

Nested tabbox switch, doesn't select the correct tab

asked 2019-07-17 16:59:11 +0800

MaurizioB gravatar image MaurizioB
3 2

I use the tabbox with a MVVM approach of using a model.

When I switch both a parent tab, and a child tab (in a tabbox I never visualized, even if it has been initialized), the selected tab of the ViewModel and the visualized tab.

I recreated the issue inside this fiddle (zkfiddle.org/sample/2gmeisd/4-Switch-2-tabs-doesn-t-register).

Pressing the button should change to tab 22, but it visualize tab 12 instead (even if selectedTab in the VM is correctly 2_2). If instead of pressing the button direcly I first switch to tab2, then return to tab1 and press the button everything works as intended.

Is there any way to correct this or it is a known bug?

delete flag offensive retag edit

4 Replies

Sort by » oldest newest

answered 2019-07-18 11:39:01 +0800

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

updated 2019-07-31 12:26:23 +0800

Because client render-on-demand is enabled by default, ZK doesn't render Tab 2 at page creation. Only when you select "Tab 2", it just creates the corresponding HTML elements for performance reason. It looks like Tabbox widget can't create tab's DOM and set selected tab at once.

If you don't have many tabs, disable client render-on-demand can solve this problem:

<custom-attributes org.zkoss.zul.client.rod="false"/>

Ref: https://www.zkoss.org/wiki/ZKConfigurationReference/zk.xml/TheLibraryProperties/org.zkoss.zul.client.rod

BTW, since you use ListModelList which can notify the change to its bound Tabbox automatically, you don't need to notify manually by:

BindUtils.postNotifyChange(null, null, this, "tabInfos"); //can remove this line

a bug for your case in our tracker: https://tracker.zkoss.org/browse/ZK-4344

link publish delete flag offensive edit

answered 2019-07-25 20:51:48 +0800

MaurizioB gravatar image MaurizioB
3 2

@hawk Thank you a lot, with the custom-attribute workaround now it works, and the impact on the performances seems reasonable while waiting for the ticket.

link publish delete flag offensive edit

answered 2019-07-30 14:49:48 +0800

mikrobe gravatar image mikrobe
100 1 5

Thanks for raising the issue, I was struggling to solve it by myself. BTW, @hawk I cannot find the ticket in order to start watching it, would you kindly share the link?

link publish delete flag offensive edit

answered 2019-11-18 10:08:34 +0800

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

Please try our latest release, 9.0.0-RC2-Eval, which contain this fix.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2019-07-17 16:59:11 +0800

Seen: 23 times

Last updated: Nov 18 '19

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