Uploaded image for project: 'Documentation'
  1. Documentation
  2. TIDOC-1968

Android: TableView: SearchBar not working if "filterAttribute" is an arbitrary property

    Details

    • Customer Priority:
      Immediate
    • Customer Labels:
    • Story Points:
      5
    • Sprint:
      2014 Sprint 22 Documentation

      Description

      Description

      When using SearchBar, it is possible to set in the TableView a filterAttribute. However, if this attribute is set AFTER the TableViewRow is created, the SearchBar will not work on Android. Same code works fine on iOS.

      Sample Code

      var win = Ti.UI.createWindow({
      	backgroundColor: 'white'
      });
       
      var bar = Ti.UI.createSearchBar();
       
      var rows = [];
      for (var i=1; i<=10; i++) {
      	var text = 'sample' + i;
      	
      	var label = Ti.UI.createLabel({
      		text: text
      	});
      	var row = Ti.UI.createTableViewRow();
      	row.filter = text;
      	row.add(label);
      	rows.push(row);
      }
       
      var table = Ti.UI.createTableView({
      	data: rows,
      	search: bar,
      	filterAttribute: 'filter'
      });
       
      win.add(table);
       
      win.open();
      

      Alloy

      The problem is more clear using Alloy: if you hve a row element and you set $.row.filter in the controller, the SearchBar won't work.

        Attachments

          Activity

            People

            • Assignee:
              bhatfield Benjamin Hatfield (Inactive)
              Reporter:
              sliang Shuo Liang
              Reviewer:
              Ping Wang
            • Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 day
                1d

                  Backbone Issue Sync

                  • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                    Git Integration