Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Dashboard - prevent editing

How do I prevent a DashboardView from entering edit mode when holding down an Item…

Currently I have:

dashboard.addEventListener('edit', function() {
    dashboard.stopEditing();
});

which stops the edit mode immediately when it starts, but it has 2 side effects:

  • it results in a click (ie. the action assigned to clicking the dashboard item gets executed
  • it renders the icon with a white overlay that you can't get rid of (i guess that's the press down state)

Any ideas?

— asked September 16th 2010 by Michael Steuer
  • dashboard
  • dashboarditem
  • dashboardview
  • stopediting
1 Comment
  • I've worked around this by going into the Xcode project and setting the constant for the amount of seconds a user needs to hold a DashboardItem to enter "editing" mode to something ridiculously high, whereby thus essentially disabling editing mode…

    — commented September 17th 2010 by Michael Steuer

5 Answers

  • As of Titanium Mobile SDK version 1.7.0 (that comes with Titanium Studio), it looks like the Kitchen Sink example contains a solution with it's Dashboard view example. Here's a useful snippet to not make your dashboard editable:

    var dashboard = Titanium.UI.createDashboardView({
        data:data  //data is an array of DashBoardItems you made earlier
    });
    
    dashboard.editable = false;
    

    At the time of this writing, this dashboard.editable property is not currently documented in the API (http://developer.appcelerator.com/apidoc/mobile/latest/Titanium.UI.DashboardView-object.html), but don't be fooled, it's there!

    Hope this helps.

    — answered June 23rd 2011 by Paolo Ranoso
    permalink
    1 Comment
    • thanks, I just was looking at this and it works!

      — commented July 23rd 2012 by Daniel Urstöger
  • This has been driving me crazy for a very long time, sometimes when you scroll through pages for some reason it just goes to editing mode then you are stuck, can't do any thing and have to force the application to stop.

    This is a real bad bug, I wish there was an attribute that basically stop the dashboard view from going to editing mode all together, please help.

    Thanks in advance,

    — answered November 8th 2010 by Samuel Lopez
    permalink
    0 Comments
  • This works, kind of:

    dashboard.addEventListener('edit', function() {
        dashboard.stopEditing();
    });
    

    but its kind of wonky and doesnt look clean. What you need to do is combine all the feedback into your solution.

    In addition to the above code, do as @Critter suggests:

    set each createDashboardItem with : canDelete:false

    and set the createDashboardView editing:false

    and you should be all good.

    — answered February 4th 2011 by atypical co
    permalink
    0 Comments
  • You can edit /Library/Application Support/Titanium/mobilesdk/osx/1.5.1/iphone/Classes/LauncherView.m and at line 678 add:

    return;

    per this article on the Three20 google group

    Ideally you could add a new property i.e., allowEditing, but this hack disables editing for all dashboards.

    Make sure you nuke your build directory to force a rebuild all.

    — answered February 8th 2011 by Chris Martyniuk
    permalink
    0 Comments
  • set each createDashboardItem with : canDelete:false

    and set the createDashboardView editing:false

    — answered September 17th 2010 by Critter
    permalink
    2 Comments
    • editing: false is not documented, is that correct?

      — commented September 20th 2010 by Michael Steuer
    • "editing: false" doesn't work, is it?

      — commented September 29th 2010 by Robert Rockmann
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.