Results 1 to 2 of 2

Thread: How to handle request errors on Store

  1. #1
    Sencha User
    Join Date
    Jan 2013
    Salvador, Bahia - Brazil

    Default How to handle request errors on Store

    I'm trying to show an error information in my app.
    I tried 3 different cases and in all is the same situation.
    404 error, JSON Reader error and nonexistent URL.
    In my Store added a load listener to verify the success and the store.isLoaded().
    In all cases the success returns false but store.isLoaded() returns true and I think it makes a blank page load.
    I think that should show the emptyText list property since it was not loaded any content.

    How to handle it?
    I'm calling Store.load() in the list initialize method.

    Ext.define('Amib.view.EventsList', {
        extend: 'Ext.dataview.List',
        xtype: 'eventslist',
        config: {
            cls: 'eventslist',
            disableSelection: true,
            height: '100%',
            scrollable: 'vertical',
            store: 'events',
            itemTpl: new Ext.XTemplate(
                '<div class="title">{title}</div>',
                '<div class="date">{date}</div>',
                '<div class="location">{location}</div>',
                '<tpl if="link">',
                    '<div class="more">',
                        '<input type="button" class="link" id="{link}" value="More Info"/>',
            listeners: {
                initialize: function (list) {
                itemtap: function (list, index, target, record, event) {
                    if (Ext.get('link') && !Ext.isEmpty(record.get('link'))) {
              'Base').openURL(record.get('link'), true);
    Ext.define('', {
        extend: '',
        config: {
            autoLoad: false,
            model: 'Amib.model.Event',
            storeId: 'events',
            proxy: {
                type: 'ajax',
                url: '',
                noCache: false,
                enablePagingParams: false,
                reader: {
                    type: 'json',
                    rootProperty: 'items'

  2. #2
    Sencha Premium User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Gainesville, FL


    The loaded property on the store will be set to true regardless of the request successful. Look at the docs for the load method, you can provide a callback function and one of the arguments is success:

        callback: function(records, operation, success) {
            // the operation object contains all of the details of the load operation
        scope: this
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:

    Posts are my own, not any current, past or future employer's.

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