Threaded View

  1. #1
    Sencha User
    Join Date
    Sep 2011
    Vote Rating
    subimage is on a distinguished road


    Default Answered: How do I reload data for just one item in my store?

    Answered: How do I reload data for just one item in my store?

    I have a list of items in a store that I hit on my API endpoint like so:

    When I navigate to this item I'd like to be able to either give the user a chance to reload the data (from the API) manually, or do it automatically myself.

    Is this possible with Sencha? How can I accomplish this?

    Additionally, if I hit the single URL for one of these things like: returns associated nested data. I'd like to reload this associated data as well.

    I can't find a "reload", "refresh", "load", or any other type of method that will allow me to do this in the Model API.


  2. Screw it...hacked together a 'reload' method that will reload item data from its single endpoint, along with JSON associations.

    Here goes for anyone that runs into the same issue, which I suspect will be A LOT OF PEOPLE.

    Ext.define('CbMobile.model.Base', {
      extend: '',
      // Reloads a single object's data, including assocations.
      reload: function(config, scope) {
        var me = this;
        var proxy = me.getProxy(),
          idProperty = me.getIdProperty(),
          record = null,
          params = {},
          id = me.getId(),
        scope = scope || (config && config.scope) || me;
        if (Ext.isFunction(config)) {
          config = {
            callback: config,
            scope: scope
        params[idProperty] = id;
        config = Ext.apply({}, config);
        config = Ext.applyIf(config, {
          action: 'read',
          params: params
        operation  = Ext.create('', config);
        if (!proxy) {
          Ext.Logger.error('You are trying to reload a model that doesn\'t have a Proxy specified');
        callback = function(operation) {
          if (operation.wasSuccessful()) {
            record = operation.getRecords()[0];
            // Have to read the raw data for associations from response,
            // because it's not returned or decoded in the 'record' for some stupid reason.
            var response = operation.getResponse();
            var responseRawJson = Ext.JSON.decode(response.responseText); 
            Ext.callback(config.success, scope, [record, operation]);
          } else {
            Ext.callback(config.failure, scope, [record, operation]);
          Ext.callback(config.callback, scope, [record, operation]);
        };, callback, me);

Thread Participants: 2

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi