-
12 Aug 2011 12:07 AM #1
Answered: create new user in grid
Answered: create new user in grid
create new user in grid MVC
I want to create new user for gridlist ..
I create a separate panel and link the button to open it and it's work
now ,I want to save this new user to main list ,
I don't know how should I save it.
and also when I create new panel (form ) for creating new user should I
create new model also or should I use the model that i have for main list?
-
Best Answer Posted by slemmon
Yeah, they're doing in this example quite a bit of stuff. You wouldn't use the editor parts. In this example they make a 'create' event and when you click the create button it fires the create event. There is then a listener for create that responds and does the 'insert' into the grid's store. You can cut those interactions out and basically just put a handler on a button on your form that gets the grid and then its store and does an insert using the form's fields. In the example code you'll see where it does a form.getValues() and then uses that result in the store.insert(0 , form_values_as_record_here).
-
12 Aug 2011 5:22 AM #2
is any one knows about creating new user in grid list ?
-
12 Aug 2011 5:26 AM #3
Your grid and form should be able to use the same model.
To add a user to your grid you will use the grid's store's insert method.
http://docs.sencha.com/ext-js/4-0/#/...-method-insert
You might look at the code for this example. I found it very helpful myself.
http://dev.sencha.com/deploy/ext-4.0...er/writer.html
-
12 Aug 2011 5:38 AM #4
thanks for Reply
In this example they using
this.editing = Ext.create('Ext.grid.plugin.CellEditing');but what should I do when I didn't use this plug in?
Code:var rec = new Writer.Person({ first: '', last: '', email: '' }), edit = this.editing; edit.cancelEdit(); this.store.insert(0, rec); edit.startEditByPosition({ row: 0, column: 1 });
-
12 Aug 2011 5:50 AM #5
Yeah, they're doing in this example quite a bit of stuff. You wouldn't use the editor parts. In this example they make a 'create' event and when you click the create button it fires the create event. There is then a listener for create that responds and does the 'insert' into the grid's store. You can cut those interactions out and basically just put a handler on a button on your form that gets the grid and then its store and does an insert using the form's fields. In the example code you'll see where it does a form.getValues() and then uses that result in the store.insert(0 , form_values_as_record_here).


Reply With Quote