Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20188

iOS: Setting UI.SearchBar.value after tableview creation has no effect.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Low
    • Resolution: Cannot Reproduce
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: iOS
    • Labels:
    • Environment:

      iOS

    • Story Points:
      3

      Description

      Setting Titanium.UI.SearchBar value after creating tableview (or listview) is not reflecting in search results.
      Use the following code

      var fruits = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'},{title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'},{title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'},{title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'}, {title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'},{title: 'Apples'}, {title: 'Bananas'}, {title: 'Strawberry'}, {title: 'Pineapple'} ];
       
      var sampleWindow = Ti.UI.createWindow();
      var navWindow = Ti.UI.iOS.createNavigationWindow({
        window: sampleWindow
      });
       
      var search = Ti.UI.createSearchBar({hintText: "search by name", showCancel: true});
      search.addEventListener("return", searchBarReturn);
       
      var tableView = Ti.UI.createTableView();
      tableView.addEventListener("click", tableClicked);
       
      tableView.search = search;
      tableView.searchHidden = true;
      tableView.filterAttribute = 'customAttr';
       
      sampleWindow.add(tableView);
       
      fillTableData(fruits);
       
      function fillTableData(_data){
        var tempData = [];
        for(var i=0, j=_data.length;i<j;i++){
          var row = Ti.UI.createTableViewRow({
            height: 40,
            backgroundColor: "#fff",
            customAttr: _data[i].title
          });
       
          row.add(Ti.UI.createLabel({
            left:'5%',
            width:'90%',
            height:'100%',
            text: _data[i].title
          }));
       
          tempData.push(row);
        }
        tableView.setData(tempData);
      }
       
      function tableClicked(){
        Ti.API.warn("table clicked!");
      }
       
      function searchBarReturn(){
        search.blur();
      }
       
       
      navWindow.addEventListener('open', function() {
        search.value = 'App';
      });
       
      navWindow.open();
      

      Actual: All items are shown irrespective of setting search string.
      Expected: Items should be filtered as per search string.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              ssombhatla Srikanth Sombhatla (Inactive)
            • Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Titanium SDK/CLI <> Titanium Mobile
                  Synced with:
                  TIMOB-20815
                  Sync status:
                  ERROR
                  Last received:
                  Last sent:

                  Git Integration