Revision history [back]

click to hide/show revision 1
initial version

answered 2014-09-25 05:09:02 +0800

hawk gravatar image hawk

http://hawkphoenix.blogsp... ZK Team

The root cause of the error of this zkfiddle case http://zkfiddle.org/sample/3kvld74/23-Tabbox-switching-bug is that tabbox doesn't allow you to set a null selected tab. Because when you load the page, zk will set vm.selectedTab to tabbox for @bind(vm.selectedTab), for that moment, vm.selectedTab is null.

If you want to control selected tab, you can bind int to "selectedIndex" of a tabbox.

For principle of MVVM pattern, ViewModel should not hold any reference to any component. We don't encourage users to pass components as parameters to ViewModel. If you want to change a tabpanel's visibility, you should bind a VM's boolean property to tabpanel "visible" attribute, e.g.

<tabpanel visible="@bind(vm.visible")>

instead of passing that tabpanel to a command method and call tabpanel.setVisible().

The root cause of the error of this zkfiddle case case, http://zkfiddle.org/sample/3kvld74/23-Tabbox-switching-bug , is that tabbox doesn't allow you to set a null selected tab. Because when you load the page, zk will set vm.selectedTab to tabbox for @bind(vm.selectedTab), @bind(vm.selectedTab), for that moment, vm.selectedTab is null.

If you want to control selected tab, you can bind int to "selectedIndex" of a tabbox.

For principle of MVVM pattern, ViewModel should not hold any reference to any component. We don't encourage users to pass components as parameters to ViewModel. If you want to change a tabpanel's visibility, you should bind a VM's boolean property to tabpanel "visible" attribute, e.g.

<tabpanel visible="@bind(vm.visible")>

instead of passing that tabpanel to a command method and call tabpanel.setVisible().

The root cause of the error of this zkfiddle case, http://zkfiddle.org/sample/3kvld74/23-Tabbox-switching-bug, is that tabbox doesn't allow you to set a null selected tab. Because when you load the page, zk will set vm.selectedTab to tabbox for @bind(vm.selectedTab), for that moment, vm.selectedTab is null.

If you want to control selected tab, you can bind int to "selectedIndex" of a tabbox.

For principle of MVVM pattern, ViewModel should not hold any reference to any component. We don't The principle doesn't encourage users to pass components as parameters to ViewModel. If you want to change a tabpanel's visibility, you should bind a VM's boolean property to tabpanel "visible" attribute, e.g.

<tabpanel visible="@bind(vm.visible")>

instead of passing that tabpanel to a command method and call tabpanel.setVisible().

The root cause of the error of this zkfiddle case, http://zkfiddle.org/sample/3kvld74/23-Tabbox-switching-bug, is that tabbox doesn't allow you to set a null selected tab. Because when you load the page, zk will set vm.selectedTab to tabbox for @bind(vm.selectedTab), for that moment, vm.selectedTab is null.

If you want to control selected tab, you can bind int to "selectedIndex" of a tabbox.

For principle of MVVM pattern, ViewModel should not hold any reference to any component. The principle doesn't encourage users to pass components as parameters to a ViewModel. If you want to change a tabpanel's visibility, you should bind a VM's boolean property to tabpanel "visible" attribute, e.g.

<tabpanel visible="@bind(vm.visible")>

instead of passing that tabpanel to a command method and call tabpanel.setVisible().

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