Auto save
No edit summary
 
(19 intermediate revisions by 7 users not shown)
Line 1: Line 1:
=== <message>Write the content here to display this box</message>Auto Save of the Page (No Save Button Needed) ===
The default for a MDriven application is to provide users with a Save button. By doing so the user get the ability also to undo and redo changes, giving a full desktop experience.


== Auto Save of page (no Save button needed) ==
But when you develop for mobile phones, you might want to provide the user with a user interaction model where the content on the page is saved automatically and thus, remove the need for a "save button".  
Sometimes one might want to provide the user with a user interaction model where the content on the page is saved automatically and thus removing the need for a "save button". This behaviour might be removed by creating a periodic action that will save the page if it contains dirty data.


Peridic action (repeat every i.e 2000 ms, visible if there is dirty data  :  
The easiest ('''and recommended''') way to accomplish this is to use the ViewModel tagged value, [[Documentation:Span.Eco.AutoSave|Span.Eco.AutoSave]]


<pre><code>
You can also do this "manually" if you have special needs, like this:
if vCurrent_ViewModel.IsDirty  then
 
Periodic action (repeat every i.e. 2000 ms and set DisableExpression to 'not selfVM.IsDirty' in order to only run when something IS dirty) is set to be visible if there is dirty data:
 
<pre>
if selfVM.IsDirty  then
selfVM.Save;
selfVM.Save;
   0
   0
Line 12: Line 17:
   0
   0
endif
endif
</code></pre>
</pre>
 
To hide the sidebar so that it does not show the save button, please see [[Documentation:Span.HideSidebar|Span.HideSidebar]]


To hide the sidebar in order not to show the save button please see [[Layout_and_CSS]]
[[Category:View Model]]
{{Edited|July|12|2025}}

Latest revision as of 05:44, 20 February 2025

This page was created by Henrik on 2019-05-28. Last edited by Stephanie@mdriven.net on 2025-02-20.

Auto Save of the Page (No Save Button Needed)

The default for a MDriven application is to provide users with a Save button. By doing so the user get the ability also to undo and redo changes, giving a full desktop experience.

But when you develop for mobile phones, you might want to provide the user with a user interaction model where the content on the page is saved automatically and thus, remove the need for a "save button".

The easiest (and recommended) way to accomplish this is to use the ViewModel tagged value, Span.Eco.AutoSave

You can also do this "manually" if you have special needs, like this:

Periodic action (repeat every i.e. 2000 ms and set DisableExpression to 'not selfVM.IsDirty' in order to only run when something IS dirty) is set to be visible if there is dirty data:

if selfVM.IsDirty  then
selfVM.Save;
  0
else
  0
endif

To hide the sidebar so that it does not show the save button, please see Span.HideSidebar