globalcommand and save

asked 2013-05-29 13:59:13 +0800

bluegod gravatar image bluegod
3 2

I want to use @save like this:

<div  form="@id('fx') @load(vm.data) @save(vm.data, before='doSave')">

where doSave is a method in the same vm but it has been annotated as a global-command.

According to the data binding documentation for @save:

Command name must correspond to the name specified in Java annotation @Command in a ViewModel.

Is there any way I can use a global-command for the same purpose ? The same code with @command works, however if I sue @Globalcommand it doesn't. The button for saving the entity is not in the same page as the form, and I have to trigger that through a global-command in order to call that method. It is in the same VM though.

delete flag offensive retag edit


@sjoshi Where would I use that code ?

I can call the global-command fine from the other page, the problem is that @save doesn't capture the event and the entity vm.data will therefore have no changes.

bluegod ( 2013-05-29 14:40:15 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-29 14:03:40 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

I think you can try this code ...

Binder bind = (Binder) view.getParent().getAttribute("binder");
            if (bind == null)
            bind.postCommand("Your GlobalCommand Name", params);
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




Asked: 2013-05-29 13:59:13 +0800

Seen: 18 times

Last updated: May 29 '13

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