Trouble with the use of zk Live Demo - Data Filter

asked 2013-06-25 10:17:42 +0800

RobinGeissmann gravatar image RobinGeissmann
3 1

Hi there

I'm trying to get the Data Filter Demo running in my app. Slightly modified of course. I am relatively new to the whole zkoss & Frontend Java thing.

If I run the Page I get the following error: org.zkoss.zk.ui.UiException: Property 'filter' not found on type step.library.controller.KeywordFilterViewModel

I am not quite sure what it tries to tell me there, but I am sure that "filter" is around in KeywordFilterViewModel. Could you point out the mistake I am doing here, or what I am understanding wrong?

Thank you in advance

This is my code of the KeywordFilterViewModel & the page, I can post the other involved classes if there's a need for that;

<?page title="Auto Generated index.zul"?>
<tabbox vflex="1" hflex="1">
        <tab label="test" />
        <tab label="" />
        <tabpanel vflex="1" hflex="1">
            <borderlayout vflex="1" hflex="1" >
                <west size="30%" border="0">
                    <div vflex="1" hflex="1" apply="org.zkoss.bind.BindComposer" viewModel="@id('vm') @init('step.library.controller.KeywordFilterViewModel')">
                        <grid vflex="1" hflex="1">
                                    <bandbox autodrop="false" hflex="1" value="@bind(vm.filter.id)" onChange="@command('changeFilter')">
                            <template name="model">
                                    <label value="@load(each.id)"/>
                <center border="0">

package step.library.controller;

import java.util.List;

import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;

import step.library.data.Keyword;
import step.library.data.KeywordData;
import step.library.controller.KeywordFilter;

public class KeywordFilterViewModel {
    private KeywordFilter filter = new KeywordFilter();
    List<Keyword> currentKeyword = KeywordData.getAllKeywords();

    public KeywordFilter getKeywordFilter(){
        return filter;

    public ListModel<Keyword> getKeywordModel(){
        return new ListModelList<Keyword>(currentKeyword);

    public void changeFilter(){
        currentKeyword = KeywordData.getFilteredKeywords(filter);
delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-06-25 13:03:29 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8

updated 2013-06-25 13:09:53 +0800

You can check here zk-listbox-data-filter-demoOR See below Sample ...Its a Basic demo... ZUL FIle

<?page title="Auto Generated index.zul"?>
<window apply="org.zkoss.bind.BindComposer"
    viewModel="@id('vm') @init('demo.listbox.FilterViewModel')">

    <listbox model="@load(vm.modelList)">

        <auxhead sclass="category-center">
            <auxheader colspan="1">
                <textbox instant="true" width="100px"
                    value="@bind(vm.people.name)" onChange="@command('changeFilter')" />

            <listheader label="Name"></listheader>
            <listheader label="Age"></listheader>
            <listheader label="Id"></listheader>
        <template name="model" var="person">

                    <label value="@load(person.name)" />
                    <label value="@load(person.age)" />
                    <label value="@load(person.id)" />


Java Code or ViewModel

package demo.listbox;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

import org.zkoss.bind.annotation.AfterCompose;
import org.zkoss.bind.annotation.Command;
import org.zkoss.bind.annotation.NotifyChange;
import org.zkoss.zul.ListModel;
import org.zkoss.zul.ListModelList;

public class FilterViewModel {

    private List myPersonList;
    private Person people = new Person();
    private ListModel<Person> modelList;

    public void afterCompose() {
        myPersonList = new ArrayList<Person>();

        myPersonList.add(new Person("Hariom", 1, "om1"));
        myPersonList.add(new Person("Narayan", 2, "Hariom1"));
        myPersonList.add(new Person("Shiv", 3, "shiv"));
        myPersonList.add(new Person("Ram", 4, "Maa"));
        myPersonList.add(new Person("Krishna", 5, "Durga"));
        modelList = new ListModelList<Person>(myPersonList);

    public void changeFilter() {
        List myPersonList1 = getFilterPersons(people);
        modelList = new ListModelList<Person>(myPersonList1);

    public List<Person> getFilterPersons(Person personObj) {
        List<Person> personsList = new ArrayList<Person>();
        String name = null;
        Integer age = null;
        String id = null;
        if (personObj!=null && personObj.getName() != null)
            name = personObj.getName().toLowerCase();
        if (personObj!=null && personObj.getAge() != null)
            age = personObj.getAge();
        if (personObj!=null && personObj.getId() != null)
            id = personObj.getId().toLowerCase();

        for (Iterator<Person> i = myPersonList.iterator(); i.hasNext();) {
            Person tmp = i.next();

            if (tmp.getName().toLowerCase().contains(name) && !name.trim().isEmpty() ) {

        return personsList;
            return myPersonList;

    public class Person {
        String name;
        Integer age;
        String id;

        public String getName() {
            return name;

        public Integer getAge() {
            return age;

        public String getId() {
            return id;

        public void setName(String name) {
            this.name = name;

        public void setAge(Integer age) {
            this.age = age;

        public void setId(String id) {
            this.id = id;

        public Person() {


        public Person(String name, Integer age, String id) {
            this.name = name;
            this.age = age;
            this.id = id;


    public List getMyPersonList() {
        return myPersonList;

    public Person getPeople() {
        return people;

    public void setMyPersonList(List myPersonList) {
        this.myPersonList = myPersonList;

    public void setPeople(Person people) {
        this.people = people;

    public ListModel<Person> getModelList() {
        return modelList;

    public void setModelList(ListModel<Person> modelList) {
        this.modelList = modelList;

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

1 follower



Asked: 2013-06-25 10:17:42 +0800

Seen: 35 times

Last updated: Jun 25 '13

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