Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2635] iOS: DashboardView.setData appears to just append data items to the array

GitHub Issuen/a
TypeBug
PriorityLow
StatusClosed
ResolutionInvalid
Resolution Date2017-05-02T18:05:08.000+0000
Affected Version/sRelease 3.0.0
Fix Version/sn/a
ComponentsiOS
Labelsapi
ReporterAaron K. Saunders
AssigneeIngo Muschenetz
Created2011-04-15T03:25:27.000+0000
Updated2017-05-02T21:13:20.000+0000

Description

Also the data array count is not incremented and when retrieving the data property, it does not contain the items that were appended

// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({  
    backgroundColor:'#fff'
});

var item = Ti.UI.createDashboardItem({badge:1, image: "KS_nav_ui.png" });
var dboard = Titanium.UI.createDashboardView( {
  top: 45,
  width: '100%',
  data:[item]
});


win1.add(dboard);
var button = Titanium.UI.createButton( { title: "populate",height:35, top: 2, width: 100 } );
button.addEventListener("click", function (e) {
  var item2 = Ti.UI.createDashboardItem({badge:dboard.data.length, image: "KS_nav_ui.png" });
  Titanium.API.info("Button clicked");
  dboard.setData([item2]);
  dboard.show();
  Titanium.API.info("dboard.data length "+dboard.data.length);
  Titanium.API.info("dboard.data " + dboard.data);
});
win1.add(button);
win1.open();

Comments

  1. Charles Daniel 2011-04-15

    I'd like to second this bug ticket. Looking in the
    /Library/Application Support/Titanium/mobilesdk/osx/1.5.1/iphone/Classes/TiUIDashboardView.m

    under line 50 the setData method

       -(void)setData:(id)args
       {

       [self launcher];
       
       for (TiUIDashboardItemProxy *proxy in args)
       {
           ENSURE_TYPE(proxy,TiUIDashboardItemProxy);
           [launcher addItem:proxy.item animated:NO];
       }
       
       
       
       
    }

    You'll notice that all it ever does is addItem to the LauncherView. You can't set DashboardView.data directly to overwrite the existing dashboard, all it will ever do is append.

  2. Pedro Enrique 2011-04-27

    Also, a feature request to be able to add and remove items programatically. A helpdesk ticket is asking for this: http://support-admin.appcelerator.com/display/APP-556514 Suggested methods: - dashboard.addItem( ); - dashboard.removeItem( );
  3. Stephen Tramer 2012-07-26

    Confirmed with SDK 2.2.0.014b86f
  4. Lee Morris 2017-05-02

    Resolving ticket as Invalid as there is now a new version of Kitchen Sink available and we no longer support the version which relates to this ticket.

JSON Source