[TIMOB-15995] Add support for NSAnchoredSearch in Titanium.UI.TableView search options
| GitHub Issue | n/a |
|---|---|
| Type | New Feature |
| Priority | High |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2014-04-15T16:57:59.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | 2014 Sprint 08, 2014 Sprint 08 SDK, Release 3.3.0 |
| Components | Android, iOS |
| Labels | feature, ios, module_tableview, qe-testadded |
| Reporter | Nic Hines |
| Assignee | Pedro Enrique |
| Created | 2013-12-13T20:07:05.000+0000 |
| Updated | 2014-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
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
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(); })();Link to PR: https://github.com/appcelerator/titanium_mobile/pull/5157
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)