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

Ti API: "replaceAt", "insertAt", and "getAt" functionality for view-like UI components

    Details

      Description

      Problem

      In dynamic scenarios, we often need to add view components at specific positions in parent view container. For example, if parent view container has 3 child view components, we may want to add view at first position ("add" always adds at the end).

      Currently, this is not possible to do natively in Titanium, but it's very useful feature which Titanium should have supported natively.

      Workaround

      As a workaround, this approach can be used: https://gist.github.com/1485751

      It works fine for small number of child elements, but for large number of child elements there could be performance drop.

      Solution

      Implement those functionality for all view-like components (for those components that can contain other components). I suggest following syntax:

      view.replaceAt(1, Ti.UI.createButton()); //replaces child element at index 1 with a button
      view.insertAt(1, Ti.UI.createButton()); //adds a button at index 1
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                penrique Pedro Enrique (Inactive)
                Reporter:
                ivan.skugor Ivan Skugor
                Reviewer:
                Vishal Duggal (Inactive)
              • Watchers:
                15 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