1

how to get the listbox 'selectedItem' value when i click a button on the row

asked 2014-04-30 03:24:44 +0800

zkyishuqq1 gravatar image zkyishuqq1 flag of China
26 3

updated 2014-05-01 05:57:48 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

i'm new with zk

Now i have a question with MVVM pattern.

in a listbox , it has [selectedItem="@bind(vm.selectedAllocationItem)"] attribute.

every row has an toolbarbutton A .

when i click the A on one row , it will trigger the onClick event, but the selectedAllocationItem can't change because i click the button,i haven't selected this row ,so the 'selectedAllocationItem' can't change.

so, how to change the 'selectedAllocationItem' to get the correct value when i click the button.

delete flag offensive retag edit

Comments

This depends on how you render your listbox. Can you provide the zul and if a renderer is used the renderer? (and your command what you trigger from the button)

chillworld ( 2014-04-30 06:09:53 +0800 )edit

Indeed, when you use template you have it to do like that, otherwise if you used a renderer you had to add an eventlistener to the button.

chillworld ( 2014-04-30 08:10:34 +0800 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2014-04-30 07:45:23 +0800

zkyishuqq1 gravatar image zkyishuqq1 flag of China
26 3

updated 2014-05-05 15:28:13 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

OK, I find the way to resolve it.
just add the "data=each" to pass the value to the server,so the serverc can get the correct value.

<toolbarbutton  onClick="@command('onClick$deleteAllItems',data=each)" />
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
1 follower

RSS

Stats

Asked: 2014-04-30 03:24:44 +0800

Seen: 37 times

Last updated: May 05 '14

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