0

It is possible to update Grid's Master detail data with onOpen event?

asked 2020-04-07 23:23:22 +0800

softteam gravatar image softteam
130 1 8

Hello everyone,

I have a Grid with a detail and I want to know if it is possible to update detail data when onOpen event is fired. I have N rows and I want to update the open row exclusively.

Thanks in advance!

Javier

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2020-04-08 10:37:43 +0800

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

I think just registering an onOpen listener to update content in <detail> is enough like https://zkfiddle.org/sample/32249o4/2-details-onOpen-listener

link publish delete flag offensive edit
0

answered 2020-04-08 18:30:21 +0800

softteam gravatar image softteam
130 1 8

Thanks for your response,

I load the value of a label with the data of a variable in a .java file controller. If I change this value when the detail is open, in fact in the onOpen event, the value never changes. I got something like this:

<zk >
  <vlayout apply="org.zkoss.bind.BindComposer" viewModel="@id('vm')>
    <row>
      <detail onOpen="@command('onOpenEvent')"> 
        <label value="@load(vm.labelValue)"/>
      </detail>
   </vlayout>              
</zk>

In this case, is it possible to change this variable value (vm.labelValue) in the .java file and reflect this change in the detail's label value?

Thanks!

link publish delete flag offensive edit
0

answered 2020-04-09 10:24:13 +0800

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

If you notify a change for vm.labelValue, ZK will reload the variable.

@NotifyChange("labelValue")
@Command
public void onOpenEvent(){
    ...
}

Please refer to http://books.zkoss.org/zk-mvvm-book/8.0/viewmodel/notification.html

If the above suggestion doesn't solve your problem, please post your ViewModel code

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

RSS

Stats

Asked: 2020-04-07 23:23:22 +0800

Seen: 10 times

Last updated: Apr 09 '20

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