1. #1
    Sencha User
    Join Date
    May 2010
    Location
    Kiev, Ukraine
    Posts
    134
    Vote Rating
    6
    khmurach is on a distinguished road

      0  

    Default Best practice for create/update operation

    Best practice for create/update operation


    I wrote this post as a demo for MVC Architecture Guide.
    And I have a question:

    Which is the best practice for create/update operations:
    model.set(values) & store.sync()
    or
    form.post() & store.load()?
    Vitaliy Khmurach
    Web Developer
    http://ext4all.com

  2. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    It will depend on each specific situation. I myself often use the first way because it will generate only one request to server (updating record only) while the second way will generate two requests (updating record and loading grid data).

  3. #3
    Sencha User
    Join Date
    May 2010
    Location
    Kiev, Ukraine
    Posts
    134
    Vote Rating
    6
    khmurach is on a distinguished road

      0  

    Default


    Vietits, thanks, for reply.
    In first way, server should return only created/updated records?
    Vitaliy Khmurach
    Web Developer
    http://ext4all.com

  4. #4
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Yes. I often reduce the volume of transfered data by:
    - With creating request, I return success response with only id of newly created record, not the whole record, e.g {success: true, root: [{id: <ID of new record>}]}. This is used to update the id of newly created record in the grid.
    - With updating request, I return success respone with no data, e.g {success: true}.

  5. #5
    Sencha User
    Join Date
    May 2010
    Location
    Kiev, Ukraine
    Posts
    134
    Vote Rating
    6
    khmurach is on a distinguished road

      0  

    Default


    Vietits, thanks for tips. One more question: if i use paging by 20 items, newly added item will be added as 21th to current page of grid. Is it right?
    Vitaliy Khmurach
    Web Developer
    http://ext4all.com

  6. #6
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Vote Rating
    109
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Yes, that's right.

Thread Participants: 1

Tags for this Thread

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar