0

ZK 8.5: Listboxitem setCheckable (setSelectable) not work anymore

asked 2017-11-16 18:39:08 +0800

Tedatzs gravatar image Tedatzs
3 2

updated 2017-11-22 15:59:43 +0800

After updating from 7.05 to 8.5 the setCheckable(false) method (deprecated) not work anymore. I used the setSelectable method too, but the checkable icon (mode multiple) stays visible and the item can be selected. The current workaround for me is to disable the whole item.

Any suggestion?

delete flag offensive retag edit

Comments

I assume you are updating from 7.0.5 to 8.5.0 ? or 8.0.5? just to give the best answer this might help.

cor3000 ( 2017-11-16 20:26:07 +0800 )edit

Checked my maven pom, upgrade was from ZK 7.05 to 8.5.0

Tedatzs ( 2017-11-16 20:34:46 +0800 )edit

Robert,

please check the following example with a selectable and not selectable button example what create list items. Check the result with zk 7.05 and 8.05. You can reproduce the difference here.

http://zkfiddle.org/sample/1gikj3n/15-test-selectable-Listbox-with-DataFilter

Tedatzs ( 2017-11-17 17:56:22 +0800 )edit

And the difference did start with ZK 8.0

Tedatzs ( 2017-11-17 18:05:24 +0800 )edit

Alright, this work. Was not aware that the item renderer is not the right place for the selection control

Tedatzs ( 2017-11-17 20:13:39 +0800 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2017-11-17 18:49:04 +0800

cor3000 gravatar image cor3000
4079 1 7
ZK Team

First I wasn't aware you were using a List model, now things are clear.

Since ZK 8.0.0 selectability is controlled by the list model using the SelectionControl. The default implementation always returns true. If you have a different condition you can implement the interface or extend the DefaultSelectionControl.

In your case I added the following to the FilterModel class

modelList.setSelectionControl(new DefaultSelectionControl<Row>(modelList) {
  public boolean isSelectable(Row row) {
   return row.isSelectable();
  }
});

And removed the obsolete part from MyRowRenderer -> updated example

This new interface was introduced as a fix for ZK-2534

link publish delete flag offensive edit
0

answered 2017-11-16 20:50:37 +0800

cor3000 gravatar image cor3000
4079 1 7
ZK Team

I tested this zkfiddle example using 8.0.5 and 8.5. In both versions the selectable/checkable attribute works as expected. Can you please update the zkfiddle to reproduce your exact problem with the selectable property?

You can see in the source code that both selectable/checkable have the same implementation so there should be no difference at all: https://github.com/zkoss/zk/blob/master/zul/src/org/zkoss/zul/Listitem.java#L83-L128

If in doubt you can set a breakpoint in those methods to verify who/what is calling them.

Regards,

Robert

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: 2017-11-16 18:39:08 +0800

Seen: 18 times

Last updated: Nov 22 '17

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