Results 1 to 3 of 3

Thread: Store.Sync() or Ext.Ajax ?

  1. #1
    Sencha User
    Join Date
    Feb 2014
    Posts
    15

    Default Store.Sync() or Ext.Ajax ?

    My application has multiple grids & forms with add & update button on top.
    I have connected forms and grids with their respective stores.


    These Grids/Forms need to be updated quite frequently,both to and from server
    Now while reading about stores from tutorials, i found that store.sync() is correct method to be used.


    But i need to send some other dynamic values as well along with usual Post data to server.
    Also i need to capture response from server and do some action. I am unable to find any thing like that.


    Should i use Ext.ajax method on click of button, though this was the method i was trying to avoid.
    I am new into this, Guide me the correct approach.


    Thanks.

  2. #2
    Sencha Premium User mrsunshine's Avatar
    Join Date
    Sep 2008
    Location
    Germany - Darmstadt
    Posts
    693
    Answers
    21

    Default

    sync() is the right way.
    If you like to add additional data you can hook into the beforesync event of the store
    http://docs.sencha.com/extjs/4.2.2/#...ent-beforesync

    and add extra params to the store proxy which is doing the request
    http://docs.sencha.com/extjs/4.2.2/#...-setExtraParam

  3. #3
    Sencha User
    Join Date
    Feb 2014
    Posts
    15

    Default

    Sunshine

    I understand that store.sync is correct way for this but since i am new into this, its getting difficult to manipulate things with store.sync.

    1) I want to alter the parameters being sent to server by store
    2) Add few dynamic parameters.
    3) Capture the response from server.

    As you mentioned about links :

    -> I din't get the use of beforesync. Is it an event triggered before syncing ? which requirement will it fulfill ?

    -> I understand the use of setExtraParam( name, value ), will use it and revert if any issue occurs.

    -> Also let me know how to capture response of store ? It is important.

    Thanks

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •