Filter a tablewview manually

You must Login before you can answer or comment on any questions.

Hi, I've create a searchbar beside a tableView. I don't want to connect these two components with the property .search of the tableView. When i enter a character in my searchbar I want to filter my rows in the listview. My idea is to add an event listener for the event 'change' to the searchbar. But how I have to implement the filter for the tableview? Which method should i call to filter the items?

— asked 7 months ago by Alexander Stark
2 Comments
  • We cannot answer your question. Please refer to Ask a Question and Using Questions and Answers, and provide us the required information so that w can help you.

    — commented 7 months ago by Shannon Hicks

  • I'm using Titanium 2.1.3. I want to filter the list items manually on Android and iOS. In my view no more information are necessary. I can give you some code snippets, but I don't think that will help.

    this.searchView = Ti.UI.createView({
            layout: 'composite',
            top: 5,
            width: '95%',
            //backgroundColor: '#6E6E6E',
            height: 60,
            //borderColor: '#6E6E6E',
            borderRadius: 20,
            borderWidth: 1,
            backgroundGradient: {
                type: 'linear',
                startPoint: { x: '0%', y: '0%' },
                endPoint: { x: '0%', y: '100%' },
                colors: [ { color: '#BDBDBD', offset: 0.0}, { color: '#6E6E6E', offset: 1.0 } ],
        }
        });
        this.mainView.add(this.searchView);
    ...
        this.searchBar = Titanium.UI.createSearchBar({
            height: 40,
            width: '90%',
            //top: 6,
            backgroundColor: 'transparent'
     
        });
        if (Ti.Platform.osname == 'android') {
            this.searchBar.hide();
        };
        this.searchView.add(this.searchBar);
    ...
        this.listView = Ti.UI.createTableView({
            scrollable: true,
            //search: this.searchBar,
            width: '100%',
            top: 0,
            backgroundColor: 'transparent'
        });
        this.containerView.add(this.listView);
    I don't have implemented the eventlistener yet. I just want to know what i sould do with my tablewview to filter the items with the characters of my searchbar

    — commented 7 months ago by Alexander Stark

1 Answer

Your Answer

Think you can help? Login to answer this question!