Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-16879

ScrollableView: Add "insertViewsAt()" method

    Details

    • Story Points:
      5
    • Sprint:
      2016 Sprint 09 SDK

      Description

      The ScrollableView currently supports the ".addView()" method to programmatically append additional views to the end of the collection. However, it has no method to insert one or more views at the beginning (prepend), or somewhere in the middle of the collection.

      A suggested workaround for this limitation involves getting the views array with .getViews(), updating the array, then re-assiging the views array back to the control with .setViews(). While this works, it is not efficient and causes significant flickering on the UI with complex views, every time .setViews() is used.

      It would be great to have a method like ".insertViewsAt(idx, views)" so one item (or more) can be prepended or inserted at specific locations without requiring the entire views collection to be re-bound and rendered.

      This would also bring the ScrollableView control in line with ListView and TableView, both of which feature "insert" methods.

      In my particular case; I'm using a ScrollableView to page through over 500 views which are fairly complex. Loading all views into the ScrollableView is not an option as that takes too much memory and crashes the app. My solution is to have a sliding range that loads 9 views at a time (4 before and 4 after the current page) on the ScrollableView. And as the user moves left or right, it dynamically prepends or appends more views as needed, removing views also from the opposite end so only 9 views are loaded at any given time. Appending with addView() works well (no need for setViews(), so no flickering), but prepending with the getViews()/update/setViews() process does not work well in these situations.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                hknoechel Hans Knöchel
                Reporter:
                bcproductions Ed
                Reviewer:
                Angel Petkov
              • Watchers:
                24 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 Integration