Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-23187] Windows: Implementation of search functionality using searchText property in listview

GitHub Issuen/a
TypeImprovement
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2016-07-01T17:11:32.000+0000
Affected Version/sn/a
Fix Version/sRelease 5.4.0
ComponentsWindows
Labelsqe-5.4.0
ReporterRakhi Mitro
AssigneeKota Iguchi
Created2016-04-11T09:42:36.000+0000
Updated2016-07-01T17:11:42.000+0000

Description

list view search is not working correctly.Using the *searchableText* property on a listitem and the *searchText* property on the listview through text entered in a text field: the text "Search Results" appears with no search results below, even though the entered text should match with some list items. Are there any plans to return this functionality to the searchText property of the listview in upcoming releases?

Comments

  1. Kota Iguchi 2016-04-25

    https://github.com/appcelerator/titanium_mobile_windows/pull/644
  2. Harry Bryant 2016-06-30

    Tested with the demo code provided in the PR. searchText does not provide results, only in the case that I enter "A", otherwise no results are shown. Attempted both with ListView.caseInsensitiveSearch set to true / false. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201606220541 Ti SDK: 5.4.0.v20160630074247 Appc NPM: 4.2.7-2 Appc Core: 5.4.0-23 Node: v4.4.4 *Reopening Ticket.*
  3. Kota Iguchi 2016-07-01

    I could not reproduce the issue on 5.4.0.v20160630074247. [~htbryant] Could you try following code? I want to narrow it down to see if it's general issue or UI event / IME related issue or some kind.
       var win = Ti.UI.createWindow({ backgroundColor: 'green', layout: 'vertical' });
       var searchText = Ti.UI.createTextField({ width: Ti.UI.FILL, height: '10%' });
       
       var listView = Ti.UI.createListView({ width: Ti.UI.FILL, height: '90%', caseInsensitiveSearch: true });
       var sections = [];
       
       var fruitSection = Ti.UI.createListSection({ headerTitle: 'Fruits' });
       var fruitDataSet = [
           { properties: { title: 'Apple', searchableText: 'Manzana' } },
           { properties: { title: 'Banana', searchableText: 'Plátano' } },
       ];
       fruitSection.setItems(fruitDataSet);
       sections.push(fruitSection);
       
       var vegSection = Ti.UI.createListSection({ headerTitle: 'Vegetables' });
       var vegDataSet = [
           { properties: { title: 'Carrots', searchableText: 'Zanahorias' } },
           { properties: { title: 'Potatoes', searchableText: 'Patatas' } },
       ];
       vegSection.setItems(vegDataSet);
       sections.push(vegSection);
       
       listView.sections = sections;
       
       searchText.addEventListener('change', function () {
           listView.searchText = searchText.value;
       });
       
       var queries = [
           "Man",  /* 'Apple' */
           "Pl",   /* 'Banana' */
           "ta",   /* 'Banana', 'Potatoes' */
           'z',    /* 'Apple', 'Carrots'*/
           'zanah',   /* 'Carrots' */
           'horias',  /* 'Carrots' */
           'A'     /* 'Apple', 'Banana', 'Carrots', 'Potatoes' */
       ];
       
       var index = 0;
       win.addEventListener('open', function() {
           setInterval(function(){
               searchText.value = queries[index];
               index++;
               if (index >= queries.length) {
                   index = 0;
               }
           }, 5000);
       });
       
       win.add(searchText);
       win.add(listView);
       win.open();
       
  4. Harry Bryant 2016-07-01

    [~kota] Tested the code you provided and it works correctly, repeated the test case manually with the test code in the PR and it works correctly too. I was testing for exact string matches, which I had misinterpreted. Tested on: Windows 10 Pro Windows Phone 10.0 (Microsoft Lumia 640 LTE) Appc Studio: 4.7.0.201606220541 Ti SDK: 5.4.0.v20160630074247 Appc NPM: 4.2.7-2 Appc Core: 5.4.0-23 Node: v4.4.4 *Closing Ticket.*

JSON Source