Revision history [back]

click to hide/show revision 1
initial version

answered 2015-02-13 11:30:19 +0800

chillworld gravatar image chillworld flag of Belgium

https://github.com/chillw...

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Greetz chill.

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Edit :

You can change the integer in the viewmodel to String, then it would work.

Or you can cast the 1 to integer in the zul like in this fiddle.

Greetz chill.

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Edit :

You can change the integer in the viewmodel to String, then it would work.

Or you can cast the 1 numbers to integer in the zul like in this fiddle.

Greetz chill.

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Edit :

You can change the integer in the viewmodel to String, then it would work.

Or you can cast the numbers to integer in the zul like in this fiddle.

Greetz chill.

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Edit :

You can change the integer in the viewmodel to String, then it would work.

Or you can cast the numbers to integer in the zul like in this fiddle.

Edit 2 (Why is mine fiddle showing error):

change :

import org.zkoss.bind.annotation;

to :

import org.zkoss.bind.annotation.*;

reason : he search for the class annotation in stead of useing the whole package.

second :

Your AfterCompose class is ambigious, what means there are 2 classes with that name in the imports.

Now, for MVVM the standard initialisation is to use :

@Init
public void initsetup() }
}

You don't need to use @AfterCompose, only is rare occasions.(I never needed it in projects)

The view, don't put it there if you don't use it, it's just making the application heavier.

Your fiddle will still not work with these 2 changes because you have still an String in the zul and Integer in the viewmodel.
The above fiddle of me without the initialisation was already set up for Integer usage(old one).
I just have changed mine fiddle so it works wityh the initialisation in Integer.

Greetz chill.

something like this(the 1 and 2 are set in the vm.comboValue) :

<combobox selectedItem="@bind(vm.comboValue)">
    <comboitem label="No Listing " value="1" />
    <comboitem label="Show Last 30 days Listing by DOE" value="2" />
</combobox>

Edit :

You can change the integer in the viewmodel to String, then it would work.

Or you can cast the numbers to integer in the zul like in this fiddle.

Edit 2 (Why is mine fiddle showing error):

change :

import org.zkoss.bind.annotation;

to :

import org.zkoss.bind.annotation.*;

reason : he search for the class annotation annotation in stead of useing using the whole package.

second :

Your AfterCompose class is ambigious, what means there are 2 classes with that name in the imports.

Now, for MVVM the standard initialisation is to use :

@Init
public void initsetup() }
}

You don't need to use @AfterCompose, only is rare occasions.(I never needed it in projects)

The view, don't put it there if you don't use it, it's just making the application heavier.

Your fiddle will still not work with these 2 changes because you have still an String in the zul and Integer in the viewmodel.
The above fiddle of me without the initialisation was already set up for Integer usage(old one).
I just have changed mine fiddle so it works wityh the initialisation in Integer.

Greetz chill.

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