{ "id": "81477", "key": "TIMOB-5740", "fields": { "issuetype": { "id": "2", "description": "A new feature of the product, which has yet to be developed.", "name": "New Feature", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [], "resolution": null, "resolutiondate": null, "created": "2011-10-12T14:22:55.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "bug", "filter", "filters", "ios", "search", "searchbar", "tableview", "tbs-1.9.0" ], "versions": [ { "id": "11570", "description": "", "name": "Release 1.7.2", "archived": true, "released": true, "releaseDate": "2011-07-21" }, { "id": "11971", "description": "iOS5 and select Android fixes", "name": "Release 1.7.3", "archived": true, "released": true, "releaseDate": "2011-10-18" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-08-02T17:31:46.000+0000", "status": { "description": "The issue is open and ready for the assignee to start work on it.", "name": "Open", "id": "1", "statusCategory": { "id": 2, "key": "new", "colorName": "blue-gray", "name": "To Do" } }, "components": [ { "id": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "h3.Feature information\r\nWould like to be able to filter the rows by the accurate starting string.\r\n\r\n\r\nh3.Reproducible Steps\r\n1. Execute this sample code\r\n2. Put 'h' into the searchBar \r\n\r\nh3.Expected Result\r\nThe rows that are shown after putting the 'h' character should be the one that are starting with 'h'.\r\nExample screen shot attached.\r\n\r\nh3.Sample Code\r\n{code}\r\n// this sets the background color of the master UIView (when there are no windows/tab groups on it)\r\nTitanium.UI.setBackgroundColor('#000');\r\n\r\nvar win1 = Titanium.UI.createWindow({ \r\n title:'Tab 1',\r\n backgroundColor:'#fff'\r\n});\r\n\r\n// create table view data object\r\nvar data = [\r\n\t{title:'Alan', hasChild:true, header:'A'},\r\n\t{title:'Alice', hasDetail:true},\r\n\t{title:'Alexander'},\r\n\t{title:'Amos'},\r\n\t{title:'Alonzo'},\r\n\t{title:'Brad', header:'B'},\r\n\t{title:'Brent'},\r\n\t{title:'Billy'},\r\n\t{title:'Brenda'},\r\n\t{title:'Callie', header:'C'},\r\n\t{title:'Cassie'},\r\n\t{title:'Chris'},\r\n\t{title:'Cameron'},\r\n\t{title:'Don', header:'D'},\r\n\t{title:'Dilbert'},\r\n\t{title:'Deacon'},\r\n\t{title:'Devin'},\r\n\t{title:'Darin'},\r\n\t{title:'Darcy'},\r\n\t{title:'Erin', header:'E'},\r\n\t{title:'Erica'},\r\n\t{title:'Elvin'},\r\n\t{title:'Edrick'},\r\n\t{title:'Frank', header:'F'},\r\n\t{title:'Fred'},\r\n\t{title:'Fran'},\r\n\t{title:'Felicity'},\r\n\t{title:'George', header:'G'},\r\n\t{title:'Gina'},\r\n\t{title:'Gary'},\r\n\t{title:'Herbert', header:'H'},\r\n\t{title:'Henry'},\r\n\t{title:'Harold'},\r\n\t{title:'Ignatius', header:'I'},\r\n\t{title:'Irving'},\r\n\t{title:'Ivan'},\r\n\t{title:'Dr. J', header:'J'},\r\n\t{title:'Jefferson'},\r\n\t{title:'Jenkins'},\r\n\t{title:'Judy'},\r\n\t{title:'Julie'},\r\n\t{title:'Kristy', header:'K'},\r\n\t{title:'Krusty the Clown'},\r\n\t{title:'Klaus'},\r\n\t{title:'Larry', header:'L'},\r\n\t{title:'Leon'},\r\n\t{title:'Lucy'},\r\n\t{title:'Ludwig'},\r\n\t{title:'Mary', header:'M'},\r\n\t{title:'Mervin'},\r\n\t{title:'Malcom'},\r\n\t{title:'Mellon'},\r\n\t{title:'Ned', header:'N'},\r\n\t{title:'Nervous Eddie'},\r\n\t{title:'Nelson'},\r\n\t{title:'The Big O', header:'O'},\r\n\t{title:'Orlando'},\r\n\t{title:'Ox'},\r\n\t{title:'Pluto', header:'P'},\r\n\t{title:'Paris'},\r\n\t{title:'Potsie'}\r\n];\r\n\r\nvar search = Titanium.UI.createSearchBar({\r\n\tshowCancel:false\r\n});\r\n// create table view\r\nvar tableview = Titanium.UI.createTableView({\r\n\tdata:data,\r\n\tsearch:search,\r\n\tfilterAttribute:'title'\r\n});\r\n\r\n\r\n// add table view to the window\r\nwin1.add(tableview);\r\n\r\nwin1.open();\r\n\r\n{code}\r\n\r\nh3.Associated HelpDesk Ticket\r\nhttp://appc.me/c/APP-727259", "attachment": [ { "id": "23624", "filename": "expected_behavior.png", "author": { "name": "kpomaski", "key": "kpomaski", "displayName": "Karol Pomaski", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-13T08:06:16.000+0000", "size": 168703, "mimeType": "image/png" }, { "id": "23540", "filename": "searchproblem.png", "author": { "name": "kpomaski", "key": "kpomaski", "displayName": "Karol Pomaski", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2011-10-12T14:22:55.000+0000", "size": 132713, "mimeType": "image/png" } ], "flagged": false, "summary": "TiAPI: searchBar with TableView - filtering by the starting chars", "creator": { "name": "kpomaski", "key": "kpomaski", "displayName": "Karol Pomaski", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kpomaski", "key": "kpomaski", "displayName": "Karol Pomaski", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "iOS 4.3, Simulator\r\nmobile SDK 1.7.2, 1.7.3v20111007133015, 1.8.0.v20111011161014", "comment": { "comments": [ { "id": "200508", "author": { "name": "gtavridis", "key": "gtavridis", "displayName": "Gabriel Tavridis", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Is this a new feature or a bug?", "updateAuthor": { "name": "gtavridis", "key": "gtavridis", "displayName": "Gabriel Tavridis", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-06-27T00:47:56.000+0000", "updated": "2012-06-27T00:47:56.000+0000" }, { "id": "213282", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "This behaviour is expected and properly documented on Ti.UI.TableView filterAttribute documentation as seen at http://docs.appcelerator.com/titanium/2.1/index.html#!/api/Titanium.UI.TableView-property-filterAttribute\r\n\r\nNow, I think a good feature request here would be the ability to map native NSPredicate queries into Ti.UI.TableView filter, in which case, we could use Apple's querying engine for native searchbar to improve our search and even search among other fields simultaneously with more flexible queries.\r\n\r\nNote that this is quite complex, for mapping predicates natively we would need valid instance maps of the fields values to be evaluated by Predicates, this is specially troublesome when using custom rows, thus passing as an argument to Ti.UI.TableView, a predicate parameter, in a model similar to the following:\r\n\r\n{code:javascript}\r\n\r\n// Fixture Data\r\nvar tableData = [\r\n {title:'Alan', hasChild:true, header:'A'},\r\n {title:'Alice', hasDetail:true},\r\n {title:'Alexander'},\r\n {title:'Amos'},\r\n {title:'Alonzo'},\r\n {title:'Brad', header:'B'},\r\n {title:'Brent'},\r\n {title:'Billy'},\r\n {title:'Brenda'},\r\n {title:'Callie', header:'C'},\r\n {title:'Cassie'},\r\n {title:'Chris'},\r\n {title:'Cameron'},\r\n {title:'Don', header:'D'},\r\n {title:'Dilbert'},\r\n {title:'Deacon'},\r\n {title:'Devin'},\r\n {title:'Darin'},\r\n {title:'Darcy'},\r\n {title:'Erin', header:'E'},\r\n {title:'Erica'},\r\n {title:'Elvin'},\r\n {title:'Edrick'},\r\n {title:'Frank', header:'F'},\r\n {title:'Fred'},\r\n {title:'Fran'},\r\n {title:'Felicity'},\r\n {title:'George', header:'G'},\r\n {title:'Gina'},\r\n {title:'Gary'},\r\n {title:'Herbert', header:'H'},\r\n {title:'Henry'},\r\n {title:'Harold'},\r\n {title:'Ignatius', header:'I'},\r\n {title:'Irving'},\r\n {title:'Ivan'},\r\n {title:'Dr. J', header:'J'},\r\n {title:'Jefferson'},\r\n {title:'Jenkins'},\r\n {title:'Judy'},\r\n {title:'Julie'},\r\n {title:'Kristy', header:'K'},\r\n {title:'Krusty the Clown'},\r\n {title:'Klaus'},\r\n {title:'Larry', header:'L'},\r\n {title:'Leon'},\r\n {title:'Lucy'},\r\n {title:'Ludwig'},\r\n {title:'Mary', header:'M'},\r\n {title:'Mervin'},\r\n {title:'Malcom'},\r\n {title:'Mellon'},\r\n {title:'Ned', header:'N'},\r\n {title:'Nervous Eddie'},\r\n {title:'Nelson'},\r\n {title:'The Big O', header:'O'},\r\n {title:'Orlando'},\r\n {title:'Ox'},\r\n {title:'Pluto', header:'P'},\r\n {title:'Paris'},\r\n {title:'Potsie'}\r\n];\r\n\r\nvar search = Titanium.UI.createSearchBar({\r\n showCancel:false\r\n});\r\n\r\n// create table view\r\nvar tableview = Titanium.UI.createTableView({\r\n data:data,\r\n search:search,\r\n filterPredicate: \"%title BEGINSWITH[cd] %SEARCHINPUT\"\r\n});\r\n{code}\r\n\r\nWhere strings initiated with % or any other special character chosen by Appcelerator (that obviously wouldn't affect predicates or printf syntaxes nor compromises special chars searches, so we would need a escape char like %% for regular % char) would be special variables mapped against custom fields on the TableViewRow instances and the title field.\r\n\r\nWhere %SEARCHINPUT would be the dynamic text mapped from the search field on a didChange basis (char by char), allowing realtime search matching against the predicate query, as we can do on native Objective-C.\r\n\r\nThe query must obey the native format of NSPredicate syntax as in: https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html#//apple_ref/doc/uid/TP40001795\r\n\r\nAppcelerator must implement the filterPredicate parameter and proxy it against *+ predicateWithFormat:argumentArray:* evaluating it on each change of the searchBar through *- evaluateWithObject:* on each character change of the UISearchBar as per Apple Documentation on Predicates: https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSPredicate_Class/Reference/NSPredicate.html\r\n\r\nThis would make searching on TableViews substantially more powerful, allowing for much more complex searches, mapped through a native API.", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2012-08-08T01:20:02.000+0000", "updated": "2012-08-08T01:21:12.000+0000" } ], "maxResults": 2, "total": 2, "startAt": 0 } } }