0

Chosenbox selectedObjects issue

asked 2016-01-20 15:15:04 +0800

mannwo gravatar image mannwo
1

I have a Chosenbox which can bind and show all values in a ListModel<string> correctly when I try to select value from it.

I have also created a Set<string> object in the view model which I want to use to have some value pre-selected in the chosenbox box.

When I load the page, I could see the desired values selected in the Chosenbox for 1 second; and after a second the selected values gone automatically.

Below please find some of the coding; please help.

In Zul:

<grid  model="@bind(vm.model)>
...
<template>
...
    <chosenbox model="@load(each.signalsModel)"  selectedObjects="@load(each.selectedSignalString)" />
...
/template>
</grid>

In Java ViewModel:

public ListModel<SignalObject> getModel() {
            List<SignalObject> returnSignals = METHOD GENERATE THE LIST FROM DB
            return new ListModelList<SignalObject>(returnSignals);
        }

In SignalObject.java:

...
    public ListModel<String> getSignalsModel() {
            List<String> returnStrings = Arrays.asList("1","3","4","5","0");
            Collections.sort(returnStrings);
            return new ListModelList<String>(returnStrings);
        }


    public Set<String> getSelectedSignalString() {
           Set<String> selectedSignalString = new HashSet<String>();
           selectedSignalString.add("2");
           selectedSignalString.add("4");
           return selectedSignalString ;
        }
...
delete flag offensive retag edit
Be the first one to answer this question!
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: 2016-01-20 15:15:04 +0800

Seen: 17 times

Last updated: Jan 20 '16

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