-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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?
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"/>
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
Please try our latest release, 9.0.0-RC2-Eval, which contain this fix.
Asked: 2019-07-17 16:59:11 +0800
Seen: 23 times
Last updated: Nov 18 '19