Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-19111] Windows: Ti.UI.Windows.CommandBar.items.push(item) does not work

GitHub Issuen/a
TypeBug
PriorityNone
StatusClosed
ResolutionWon't Fix
Resolution Date2015-07-03T09:47:14.000+0000
Affected Version/sRelease 4.1.0
Fix Version/sRelease 5.0.0
ComponentsWindows
Labelsn/a
ReporterFokke Zandbergen
AssigneeKota Iguchi
Created2015-06-30T11:59:13.000+0000
Updated2015-08-04T16:06:29.000+0000

Description

While creating a polyfill for the missing Alloy XML support for CommandBar I discovered that:
var backButton = Ti.UI.Windows.createAppBarButton({
        icon: Ti.UI.Windows.SystemIcon.BACK
    }),
    likeButton = Ti.UI.Windows.createAppBarToggleButton({
        icon: Ti.UI.Windows.SystemIcon.LIKEDISLIKE
    }),
    forwardButton = Titanium.UI.Windows.createAppBarButton({
        icon: Ti.UI.Windows.SystemIcon.FORWARD
    }),
    commandBar = Ti.UI.Windows.createCommandBar({
        items: [backButton, likeButton]
    }),
win = Ti.UI.createWindow();

commandBar.items.push(forwardButton);

win.add(commandBar);
win.open();
does not work (the commandBar displays empty) while:
var items = commandBar.items;
items.push(forwardButton);
commandBar.items = items;
does work.

Comments

  1. Kota Iguchi 2015-07-03

    I would mark it as "Won't Fix" or "Invalid", because it is not supported on other platforms too. It is not updated because in this case push operation is basically done on *JavaScript Array object*, not onto Titanium proxy. For example, following code does not add new Tab (Tested on iOS).
       var win1 = Ti.UI.createWindow({
           backgroundColor: 'blue',
           title: 'Blue'
       });
       win1.add(Ti.UI.createLabel({text: 'I am a blue window.'}));
       
       var win2 = Ti.UI.createWindow({
           backgroundColor: 'red',
           title: 'Red'
       });
       win2.add(Ti.UI.createLabel({text: 'I am a red window.'}));
       
       var tab1 = Ti.UI.createTab({
           window: win1,
           title: 'Blue'
       }),
       tab2 = Ti.UI.createTab({
           window: win2,
           title: 'Red'
       }),
       tabGroup = Ti.UI.createTabGroup({
           tabs: [tab1, tab2]
       });
        
       var win3 = Ti.UI.createWindow({
           backgroundColor: 'green',
           title: 'Green'
       });
       win3.add(Ti.UI.createLabel({text: 'I am a green window.'}));
       var tab3 = Ti.UI.createTab({
           window: win3,
           title: 'Green'
       });
       
       tabGroup.addEventListener('open', function() {
           setTimeout(function() {
               tabGroup.tabs.push(tab3);
               //tabGroup.tabs = [tab1, tab2, tab3];
               alert('Pushed new tab. Does it work?');
           }, 3000);
       });
       
       tabGroup.open();
       
  2. Ewan Harris 2015-07-31

    Closing as per above discussion, please reopen if needed.
  3. Ingo Muschenetz 2015-08-04

    Won't fix tickets don't get a fix version.

JSON Source