Backup / Restore  page     

plugin: jquery/model/backup
test: qunit.html

You can backup and restore instance data with the jquery/model/backup plugin.

To backup a model instance call backup like:

var recipe = new Recipe({name: "cheese"});
recipe.backup()

You can check if the instance is dirty with isDirty:

recipe.name = 'blah'
recipe.isDirty() //-> true

Finally, you can restore the original attributes with backup.

recipe.restore();
recipe.name //-> "cheese"

See this in action:

© Jupiter IT - JavaScriptMVC Training and Support