Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-15995] Add support for NSAnchoredSearch in Titanium.UI.TableView search options

GitHub Issuen/a
TypeNew Feature
PriorityHigh
StatusClosed
ResolutionFixed
Resolution Date2014-04-15T16:57:59.000+0000
Affected Version/sn/a
Fix Version/s2014 Sprint 08, 2014 Sprint 08 SDK, Release 3.3.0
ComponentsAndroid, iOS
Labelsfeature, ios, module_tableview, qe-testadded
ReporterNic Hines
AssigneePedro Enrique
Created2013-12-13T20:07:05.000+0000
Updated2014-04-28T07:29:23.000+0000

Description

Add a property to support the option to apply the NSAnchoredSearch flag to the search options in the Titanium.UI.TableView See [NSAnchoredSearch](https://developer.apple.com/library/ios/documentation/cocoa/Reference/Foundation/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/c/econst/NSAnchoredSearch) for more details. I will supply the necessary changes via Pull Request as soon as possible

Comments

  1. Ritu Agrawal 2013-12-15

    Thanks for filing this enhancement request. You can submit the pull request, if available, to speed up this request. I am moving this request to engineering for further evaluation. Here is some information on how NSAnchoredSearch is used to limit the search to start or end. https://developer.apple.com/library/ios/documentation/cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/c/econst/NSAnchoredSearch http://samplecodebank.blogspot.com/2013/05/nsstring-nsanchoredsearch-example-ios.html
  2. Nic Hines 2013-12-20

    I have submitted the pull request. I have implemented it for both iOS and Android.
       /*
        * app.js - Anchored Search Test/Demo
        */
       //bootstrap and check dependencies
       if (Ti.version < 1.8 ) {
               alert('Sorry - this application template requires Titanium Mobile SDK 1.8 or later');
       }
       
       // This is a single context application with multiple windows in a stack
       (function() {
       
               var win = Titanium.UI.createWindow({
                       title:'Anchored Search Test',
                       backgroundColor:'white'
               });
       
               // create table view data object
               var data = [];
       
               data[0] = Ti.UI.createTableViewRow({title:'1. Row 1'});
               data[1] = Ti.UI.createTableViewRow({title:'2. Row 2'});
               data[2] = Ti.UI.createTableViewRow({title:'2a. Row 2a'});
               data[3] = Ti.UI.createTableViewRow({title:'3. (not 2a)'});
               data[4] = Ti.UI.createTableViewRow({title:'3a. Row 3a'});
       
               var search = Titanium.UI.createSearchBar({
                       barColor:'#385292',
                       hintText:'search'
               });
       
               search.addEventListener('change', function(e) {
                       e.value; // search string as user types
               });
               search.addEventListener('return', function(e) {
                       search.blur();
               });
       
               // create table view
               var tableview = Titanium.UI.createTableView({
                       data:data,
                       search:search
               });
       
               var toggleSwitchLabel = Titanium.UI.createLabel({
                       text:'Enable Anchored Search' ,
                       left:10
               });
       
               var toggleSwitch = Titanium.UI.createSwitch({
                       value:false,
                       color:'#999',
                       right:10
               });
       
           var osname = Ti.Platform.osname;
       
               if (osname === 'iphone' || osname === 'ipad') {
                       tableview.top = 55;
                       toggleSwitchLabel.top = 25;
                       toggleSwitch.top = 20;
               }
               else {
                       tableview.top = 50;
                       toggleSwitchLabel.top = 10;
                       toggleSwitch.top = 0;
               }
       
               toggleSwitch.addEventListener('change',function(e)      {
                       tableview.filterAnchored = e.value;
               });
       
               win.add(toggleSwitchLabel);
               win.add(toggleSwitch);
               win.add(tableview);
       
               win.open();
       })();
       
  3. Pedro Enrique 2014-04-11

    Link to PR: https://github.com/appcelerator/titanium_mobile/pull/5157
  4. Satyam Sekhri 2014-04-28

    Anchored Search works fine on tableview search Verified on: Appc Studio: 3.3.0.201404211130 SDK build: 3.3.0.v20140422163054 alloy: 1.4.0-dev CLI: titanium-3.3.0-dev titanium-code-processor:1.1.1-beta1 Xcode: 5.1.1 Osx: 10.9.2 Device: Nexus 5 (4.4.2), iPhone4 (7.1)

JSON Source