Results 1 to 3 of 3

Thread: override emptyText is not working

  1. #1
    Sencha User SurenderBhyan1's Avatar
    Join Date
    Nov 2013
    Location
    INDIA
    Posts
    130

    Default override emptyText is not working

    Hi,

    Ext JS : 4.2.1
    Chrome 40


    My requirement is to add override for enableTextSelection and for custom emptyText message in my base scripts instead of grid config.

    Issue is that enableTextselection is getting applied okay and I am able to select Text in grid cells but emptyText is not visible.

    below is code and fiddle


    Code:
    //  Not working
    Ext.override(Ext.grid.View, {
        emptyText: 'NO RECORDS'
    });
    
    
    // Working
    Ext.override(Ext.grid.View, {
        enableTextSelection: true
    });
    but when I add emptyText in viewConfig, its working fine and shows empty Text message when i filter store.

    Code:
    Its working great
    viewConfig: {
        emptyText: 'No Records Found'
       enableTextSelection: false
    }
    Fiddle: https://fiddle.sencha.com/#fiddle/i6p

    Can anyone please have an idea where I am mistaken.
    ---A ship in the harbor is safe, but that is not what the ships are made for...

  2. #2
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,791

    Default

    Your approach makes sense, you've just been unlucky. As is so often the case, the answer can be found with a little searching through the source code. Specifically, study the method getView in Ext.panel.Table:

    http://docs.sencha.com/extjs/4.2.1/s...method-getView

    The key thing to notice is that the emptyText is always specified in the config used to create the view, so the value defined on the class prototype will never be used.

    If you override Ext.panel.Table instead it should work fine.

  3. #3
    Sencha User SurenderBhyan1's Avatar
    Join Date
    Nov 2013
    Location
    INDIA
    Posts
    130

    Default

    Thank you Skirtle,
    It worked for me great and it was my bad that didn't checked for details in docs

    Your help is appreciated
    ---A ship in the harbor is safe, but that is not what the ships are made for...

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
  •