backbone-model-editor
v1.1.0
Published
Easily edit your backbone models with ModelEditor
Downloads
7
Maintainers
Readme
Backbone Model Editor
Easily edit your backbone models with inputs, textareas, date pickers, and more.
Creating a typical app requires various forms with inputs. This plugin makes creating inputs, selects, notes fields and others simple.
Rich text editor available with Redactor plugin
Example use
this.editor = new ModelEditor({
model:this.model,
el:this.el,
defaultOpts: { // default opts for each editor element
w: 120,
placeholder: 'auto' // create place
btns: true // give inputs their own save/cancel buttons
}
});
this.editor.insert('input', 'model_key');
this.editor.insert('input', 'model_key', {w:250});
this.editor.insert('input', 'model_key', {validate: 'Number'});
Then when you want to save the changes, call:
this.editor.save();
If you want the model to save automatically whenver an input changes, add "autoSave" option
this.editor = new ModelEditor({
model:this.model,
el:this.el,
autoSave:true
});