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?
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.
-
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,
-
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.
-
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.
-
set each createDashboardItem with : canDelete:false
and set the createDashboardView editing:false