[ALOY-1031] Alloy: ListView not binding correctly with Collection when using Encrypted Database Module
GitHub Issue | n/a |
Type | Bug |
Priority | High |
Status | Closed |
Resolution | Invalid |
Resolution Date | 2014-05-28T17:33:27.000+0000 |
Affected Version/s | Alloy 1.3.1 |
Fix Version/s | Alloy 1.5.0 |
Components | Models |
Labels | qe-manualtest, supportTeam |
Reporter | Marco Cota |
Assignee | Tim Poulsen |
Created | 2014-05-23T01:27:42.000+0000 |
Updated | 2018-03-07T22:28:27.000+0000 |
Description
Issue
In 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.
After testing using the standard sql type or using the encrypted database in Android everything works as expected.
Steps to repro
1. Run the Sample app attached (encDB.zip) in iOS.
2. Type 3 letter into the search bar.
Expected Result:
After inserting 3 characters the collection will fetch using a SQL query and the listView will be updated.
Actual Result:
After inserting 3 characters the collection is fetch using a SQL query but the listView is not updated.
Attachments
File | Date | Size |
encDB.zip | 2014-05-23T01:27:42.000+0000 | 9809953 |
Here's what I did to get your example app working. *Solution 1* First, I removed
onChange="didTextChangeInSearchBar"
from the<SearchBar>
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:Using 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. *Solution 2* Alternatively, you can use the ListView's native filtering function by doing this: Again, start by removingonChange="didTextChangeInSearchBar"
from the<SearchBar>
component and adding searchableText="{title}" to the ListItem. Then, to searchController.js add this single statement but not the preceding code:You 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). *Environment* * - Ti SDK 3.2.3.GA * - CLI 3.4.0-dev * - Alloy 1.4.0-alpha4 (though there's no reason why my solution above wouldn't also work with 1.3.1) * - Encrypted DB module -- the version that was included with your encDB.zip file * - App version - whatever was in encDB.zip
Works as expected when using the API techniques as documented and as illustrated in the comments added to the ticket.
Closing as invalid. If this is incorrect, please reopen.