Uploaded image for project: 'Alloy'
  1. Alloy
  2. ALOY-1684

Calling sort for a collection does not call the dataFunction as of backbone 1.1.2 and above

    Details

    • Type: Bug
    • Status: Closed
    • Priority: None
    • Resolution: Fixed
    • Affects Version/s: Alloy 1.13.9
    • Component/s: Builtins, Models
    • Labels:
      None
    • Environment:

      Alloy 1.13.9
      Backbone: 1.1.2, 1.3.3

    • Sprint:
      2019 Sprint 12

      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), sort no longer triggers a reset event but a sort event, and we don't listen for a sort event at all, 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

      Expected

      When changing the sort type to amount, orange should go to the top of the list

      Actual

      When using backbone 1.1.2, the list is not sorted when changing the sort type

        Attachments

          Activity

            People

            • Assignee:
              eharris Ewan Harris
              Reporter:
              eharris Ewan Harris
              Tester:
              Samir Mohammed
            • Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Backbone Issue Sync

                • Backbone Issue Sync is enabled for your project, but we do not have any synchronization info for this issue.

                  Git Source Code