[OPEN] [#619] Error when return StoreResult's Success set to false

Page 3 of 3 FirstFirst 123
  1. #21
    Now I see that a Store's onProxyLoad original method has been changed to:
    It's possible to overcome the issue overriding the new implementation of Ext.data.Store.onProxyLoad, as shown below (modified lines 11 to 18):

    Daniil, is it possible to fix it internally?

    Ext.data.Store.override({
        onProxyLoad: function(operation) {
            var me = this,
                resultSet = operation.getResultSet(),
                records = operation.getRecords(),
                successful = operation.wasSuccessful();
            if (me.isDestroyed) {
                return;
            }
    
            if (resultSet && successful) {
                me.totalCount = resultSet.getTotal();
                me.lastSuccessfulPage = me.currentPage;
            }
            else {
                //Sets the last successful page as the current page
                operation._page = me.currentPage = me.lastSuccessfulPage || 1;
            }
    
            if (successful) {
                records = me.processAssociation(records);
                me.loadRecords(records, operation.getAddRecords() ? {
                    addRecords: true
                } : undefined);
            } else {
                me.loading = false;
            }
            if (me.hasListeners.load) {
                me.fireEvent('load', me, records, successful, operation);
            }
            me.callObservers('AfterLoad', [
                records,
                successful,
                operation
            ]);
        }
    });
  2. #22
    Daniil, is it worth notifying Sencha regarding that issue (open a thread on its forum)?
  3. #23
    In a scenario where First Page is loaded with records, then the Refresh button is pressed and the First the page is reloaded with no records (all of them were deleted), to show Grid's EmptyText it's necessary to add the following code

    if (me.totalCount == 0 && me.currentPage == 1) {
        me.removeAll();
    }
    as shown below (lines 15 to 17):

    Ext.data.Store.override({
        onProxyLoad: function (operation) {
            var me = this,
                resultSet = operation.getResultSet(),
                records = operation.getRecords(),
                successful = operation.wasSuccessful();
            if (me.isDestroyed) {
                return;
            }
    
            if (resultSet && successful) {
                me.totalCount = resultSet.getTotal();
                me.lastSuccessfulPage = me.currentPage;
    
                if (me.totalCount == 0 && me.currentPage == 1) {
                    me.removeAll();
                }
            }
            else {
                //Sets the last successful page as the current page
                operation._page = me.currentPage = me.lastSuccessfulPage || 1;
            }
    
            if (successful) {
                records = me.processAssociation(records);
                me.loadRecords(records, operation.getAddRecords() ? {
                    addRecords: true
                } : undefined);
            } else {
                me.loading = false;
            }
            if (me.hasListeners.load) {
                me.fireEvent('load', me, records, successful, operation);
            }
            me.callObservers('AfterLoad', [
                records,
                successful,
                operation
            ]);
        }
    });
    Last edited by RaphaelSaldanha; Dec 15, 2015 at 7:43 PM.
  4. #24
    Raphael, thank you for the follow-ups!

    I'll try to apply a fix for 4.0 beta. Marked the issue with the milestone not to forget.
    https://github.com/extnet/Ext.NET/issues/619
  5. #25
    Daniil, is it worth notifying Sencha regarding that issue (open a thread on its forum)?
    I think yes.
Page 3 of 3 FirstFirst 123

Similar Threads

  1. Replies: 8
    Last Post: Dec 18, 2014, 3:00 PM
  2. [CLOSED] Problem on success/failure return from a directMethod
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Sep 30, 2013, 1:04 PM
  3. MessageBus and DirectEvent.Success = false
    By Spamme in forum 2.x Help
    Replies: 1
    Last Post: Aug 13, 2013, 12:24 PM
  4. Replies: 9
    Last Post: Jan 11, 2013, 2:38 PM
  5. Replies: 1
    Last Post: Jun 07, 2010, 7:19 AM

Posting Permissions