1. #1
    Sencha User fangzhouxing's Avatar
    Join Date
    Mar 2007
    Posts
    466
    Vote Rating
    1
    fangzhouxing is on a distinguished road

      0  

    Default Dynamically Changing url of Data Store

    Dynamically Changing url of Data Store


    When used with RESTful Web Service, I always use uri like this:
    '/users/1/comments'. When the user selected changes, the uri is also changed like '/users/2/comments'.

    But in current version of ExtJS, the url of data store is configed in creation time. When I want to refresh the data, the url cannot be changed!

    I have two choice now:
    1)use param to send the user id value, but it is not the RESTful way!
    2)use Ext.Ajax.request and convert the data into arrray, then use ArrayReader in data store.

    If we can dynamically changing url of data store, all thing become very simple.

  2. #2
    Sencha - Architect Dev Team aconran's Avatar
    Join Date
    Mar 2007
    Posts
    9,100
    Vote Rating
    113
    aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold aconran is a splendid one to behold

      0  

    Default


    Although there is no setter method for the url there should not be a problem changing it at runtime.

    Try something like:
    Code:
    myDs.proxy.url = '/users/2/comments';
    Aaron Conran
    @aconran
    Sencha Architect Development Team

  3. #3
    Sencha User fangzhouxing's Avatar
    Join Date
    Mar 2007
    Posts
    466
    Vote Rating
    1
    fangzhouxing is on a distinguished road

      0  

    Default


    Following the tip provided by @aconran, I use following code successfully:

    Code:
    myDs.proxy.conn.url = '/users/2/comments'

Thread Participants: 1