[ALOY-1684] Calling sort for a collection does not call the dataFunction as of backbone 1.1.2 and above
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | None |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2019-06-19T14:21:46.000+0000 |
Affected Version/s | Alloy 1.13.9 |
Fix Version/s | CLI Release 7.1.0, Alloy 1.14.0 |
Components | Builtins, Models |
Labels | n/a |
Reporter | Ewan Harris |
Assignee | Ewan Harris |
Created | 2019-04-30T13:26:25.000+0000 |
Updated | 2019-06-19T14:21:46.000+0000 |
Description
Description
https://github.com/appcelerator-developer-relations/appc-sample-databinding is the sample used to demo this When calling.sort()
on a collection the dataFunction should be called, however when using backbone 1.1.2 or above, this is not called. This is because (as noted in the [migration guide](https://docs.appcelerator.com/platform/latest/#!/guide/Alloy_Backbone_Migration-section-src-43290758_AlloyBackboneMigration-EventAPIs)), sort no longer triggers a reset event but a sort event, and we don't listen for a sort event [at all](https://github.com/appcelerator/alloy/blob/master/Alloy/common/constants.js#L69), to fix this we need to add "sort" to that array (probably conditionally when using 1.1.2 or greater), but this will potentially introduce an unexpected behaviour change for users
Steps to reproduce
1. Download https://github.com/appcelerator-developer-relations/appc-sample-databinding 2. Build the app to any platform 3. Click on "orange" 4. Click the "+" button 5. Go back to the main view 6. Click "Sort: name" 7. Select "Amount" 8. Now add"backbone": "1.1.2"
to your app/config.json
, clean the project and repeat steps 2-7
cc [~bhouse] [~topener], I ran into this while performing the backbone 1.4.0 upgrade. Do you think this is something we can fix safely, or would the potential behaviour change be problematic for users?
Included in the PR for the backbone 1.4.0 inclusion https://github.com/appcelerator/alloy/pull/929/commits/22ac957bbfd6e696a10cbb8a10726951d2254061
*Closing ticket*, Fix verified in CLI Version
7.1.0-master.21
tested using the test case mentioned in the description. When changing the sort type to amount, orange was able to go to the top of the list *Test Environment*