Results 1 to 6 of 6

Thread: Several problems with emptyText on the List control

    Success! Looks like we've fixed this one. According to our records the fix was applied for TOUCH-2246 in a recent build.
  1. #1
    Sencha User
    Join Date
    Aug 2011
    Posts
    88

    Default Several problems with emptyText on the List control

    REQUIRED INFORMATION


    Ext version tested:
    • ST2 Beta 3



    Browser versions tested against:
    • Chrome



    DOCTYPE tested against:
    • html



    Description:
    Issue #1:
    • Declare a list without an emptyText field
    • Some time later, call list.setEmptyText('my empty text');
    • Notice that the emptyText is never shown, but if you look in the DOM, it is there, but hidden
      <div id="ext-component-28" class="x-list"></div>
      <div id="ext-component-38" class="x-list-emptytext x-item-hidden" style="display: none !important; "><div class="x-innerhtml " id="ext-element-194">my empty text</div></div>


    Issue #2:
    • Declare a list with an emptyText field set to 'test'
    • Some time later, call list.setEmptyText('my new empty text');
    • Notice that both emptyText values are shown. In the DOM, they are two separate elements.
      <div id="ext-component-28" class="x-list-emptytext" style=""><div class="x-innerhtml " id="ext-element-178">test</div></div>
      <div id="ext-component-29" class="x-list"></div>
      <div id="ext-component-30" class="x-list-emptytext" style=""><div class="x-innerhtml " id="ext-element-186">my new empty text</div></div>
    • Some time later, add items to your store
    • Notice that the emptyText that was set as an attribute (in this case 'test') remains at the top of the list - and will remain permanently on the screen) - but that the new empty text ('my new empty text') is gone and will behave as proper new empty text.
    • I have also been able to get it into a state where the list gets somehow disconnected from its store (ie: added items in store but the list still shows as empty with both of the empty text strings visible) but I do not have a reliable reproducible use case for this.

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

    Default

    I added emptyText to the list config of the list example and changed contacts.json to just have an empty array '[]' and the empty text showed up no problem (also checked RC1 and it showed no problem).

    For the second issue I can reproduce by just using setEmptyText and reloading the store returning no results.
    Mitchell Simoens @LikelyMitch

    Check out my GitHub:
    https://github.com/mitchellsimoens

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

  3. #3
    Sencha User
    Join Date
    Aug 2011
    Posts
    88

    Default

    Quote Originally Posted by mitchellsimoens View Post
    I added emptyText to the list config of the list example and changed contacts.json to just have an empty array '[]' and the empty text showed up no problem (also checked RC1 and it showed no problem).
    Yes this works fine, but that is not the issue I was mentioning.

    The first issue is that if you do NOT add emptyText to the config and then call list.setEmptyText('.......'); afterward from some other point in your code, the empty text is hidden when the list is empty.

  4. #4
    Sencha User
    Join Date
    Mar 2007
    Location
    Redwood City, California
    Posts
    3,661

    Default

    This has been fixed for the next release. This override should resolve both issues, let me know if you have any problems with it:

    Code:
    Ext.define('Ext.overrides.DataView', {
        override: 'Ext.dataview.DataView',
        updateEmptyText: function(newEmptyText, oldEmptyText) {
            var me = this,
                store;
    
            if (oldEmptyText && me.emptyTextCmp) {
                me.remove(me.emptyTextCmp, true);
                delete me.emptyTextCmp;
            }
    
            if (newEmptyText) {
                me.emptyTextCmp = me.add({
                    xtype: 'component',
                    cls: me.getBaseCls() + '-emptytext',
                    html: newEmptyText,
                    hidden: true
                });
                store = me.getStore();
                if (store && me.hasLoadedStore && !store.getCount()) {
                    this.showEmptyText();
                }
            }
        }
    });

  5. #5
    Sencha User
    Join Date
    Mar 2013
    Location
    Ahmedabad, India
    Posts
    15

    Default

    Hey jamie,

    Thanks for your efforts, but they are not working for me in Sencha Touch 2.1.
    when I set list.setEmptyText('anything');

    it shows display none for 'x-list-emptyText'

    Thanks,
    Piyush Dholariya

  6. #6
    Sencha User
    Join Date
    Mar 2013
    Location
    Ahmedabad, India
    Posts
    15

    Default

    Hi,

    In sencha touch 2.1 when I have tried to setEmptyText its not updating view.
    so It requires to set empty data or require to bind empty store & it works for me.

    Thanks,
    Piyush Dholariya

Posting Permissions

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