1. #1
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default 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?

  2. 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).

  3. #2
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default


    is any one knows about creating new user in grid list ?

  4. #3
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,344
    Answers
    429
    Vote Rating
    198
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    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

  5. #4
    Sencha User
    Join Date
    Jul 2011
    Posts
    42
    Answers
    1
    Vote Rating
    0
    elnaz is on a distinguished road

      0  

    Default


    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         });

  6. #5
    Sencha - Support Team slemmon's Avatar
    Join Date
    Mar 2009
    Location
    Boise, ID
    Posts
    5,344
    Answers
    429
    Vote Rating
    198
    slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of slemmon has much to be proud of

      0  

    Default


    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).

Thread Participants: 1