{ "id": "130811", "key": "ALOY-1031", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "11113", "key": "ALOY", "name": "Alloy", "projectCategory": { "id": "10400", "description": "Tools for developing applications", "name": "Tooling" } }, "fixVersions": [ { "id": "15909", "description": "Alloy 1.5.0", "name": "Alloy 1.5.0", "archived": false, "released": true, "releaseDate": "2014-09-29" } ], "resolution": { "id": "7", "description": "", "name": "Invalid" }, "resolutiondate": "2014-05-28T17:33:27.000+0000", "created": "2014-05-23T01:27:42.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "qe-manualtest", "supportTeam" ], "versions": [ { "id": "15759", "description": "Alloy 1.3.1", "name": "Alloy 1.3.1", "archived": false, "released": true, "releaseDate": "2014-02-10" } ], "issuelinks": [], "assignee": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "updated": "2018-03-07T22:28:27.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13605", "name": "Models" } ], "description": "h3. Issue\r\n\r\nIn iOS when using a custom sync for enabling the Encrypted Database Module as a type for the model and binding the collection to a listView after calling the first fetch the listView get correctly populated, but when trying to call a fetch with a SQL query the listView does not reflect the new data in the collection.\r\n\r\nAfter testing using the standard sql type or using the encrypted database in Android everything works as expected.\r\n\r\nh3. Steps to repro\r\n\r\n1. Run the Sample app attached (encDB.zip) in iOS.\r\n2. Type 3 letter into the search bar.\r\n\r\nExpected Result:\r\n\r\nAfter inserting 3 characters the collection will fetch using a SQL query and the listView will be updated. \r\n\r\nActual Result:\r\n\r\nAfter inserting 3 characters the collection is fetch using a SQL query but the listView is not updated. ", "attachment": [ { "id": "48299", "filename": "encDB.zip", "author": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-05-23T01:27:42.000+0000", "size": 9809953, "mimeType": "application/zip" } ], "flagged": false, "summary": "Alloy: ListView not binding correctly with Collection when using Encrypted Database Module", "creator": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "mcota", "key": "mcota", "displayName": "Marco Cota", "active": false, "timeZone": "America/Los_Angeles" }, "environment": "CLI version 3.2.3\r\nTitanium SDK version 3.2.2.GA\r\n", "closedSprints": [ { "id": 117, "state": "closed", "name": "2014 Sprint 11 Alloy", "startDate": "2014-05-27T16:00:55.737Z", "endDate": "2014-06-07T04:00:00.000Z", "completeDate": "2014-06-09T14:18:58.490Z", "originBoardId": 124 } ], "comment": { "comments": [ { "id": "306683", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Here's what I did to get your example app working.\r\n\r\n*Solution 1*\r\n\r\nFirst, I removed {{onChange=\"didTextChangeInSearchBar\"}} from the {{}} component. Also in the XML, I added searchableText=\"{title}\" to the ListItem within the ListSection to specify the text to be searched. Then, in searchController.js, I added this to the top:\r\n\r\n{code}\r\n$.searchList.addEventListener('change', function(e){\r\n\tif($.searchList.value.trim().length >=3 ) {\r\n\t\t$.listMain.searchText = e.value;\r\n\t\tTi.API.info('****** search text = ' + e.value);\r\n\t} else {\r\n\t\t$.listMain.searchText = '';\r\n\t}\r\n});\r\n$.searchList.addEventListener('cancel', function(e){\r\n\t$.listMain.searchText = '';\r\n});\r\n{code}\r\n\r\nUsing that code, once you've entered three characters into the search box, the list is filtered as expected. If you backspace or tap Cancel, the filter is removed and the entire list contents is removed. You could merge my code here with your {{didTextChangeInSearchBar()}} function if you wanted.\r\n\r\n*Solution 2*\r\n\r\nAlternatively, you can use the ListView's native filtering function by doing this: Again, start by removing {{onChange=\"didTextChangeInSearchBar\"}} from the {{}} component and adding searchableText=\"{title}\" to the ListItem. Then, to searchController.js add this single statement but not the preceding code:\r\n\r\n{code}\r\n$.listMain.searchView = $.searchList;\r\n{code}\r\n\r\nYou can't set this property in the XML (for which I'll file a separate ticket). And it filters automatically on each character you enter (not waiting till you've entered three characters as your use-case specifies).\r\n\r\n*Environment*\r\n\r\n* - Ti SDK 3.2.3.GA\r\n* - CLI 3.4.0-dev\r\n* - Alloy 1.4.0-alpha4 (though there's no reason why my solution above wouldn't also work with 1.3.1)\r\n* - Encrypted DB module -- the version that was included with your encDB.zip file\r\n* - App version - whatever was in encDB.zip\r\n", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-28T17:32:24.000+0000", "updated": "2014-05-28T18:04:06.000+0000" }, { "id": "306685", "author": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "body": "Works as expected when using the API techniques as documented and as illustrated in the comments added to the ticket.", "updateAuthor": { "name": "skypanther", "key": "skypanther", "displayName": "Tim Poulsen", "active": true, "timeZone": "America/New_York" }, "created": "2014-05-28T17:33:27.000+0000", "updated": "2014-05-28T17:33:27.000+0000" }, { "id": "435345", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as invalid. If this is incorrect, please reopen.", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2018-03-07T22:28:27.000+0000", "updated": "2018-03-07T22:28:27.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }