Results 1 to 8 of 8

Thread: Issue on focus when dataview has items but no records

    You found a bug! We've classified it as EXTJS-25880 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Sencha User
    Join Date
    Jan 2013
    Posts
    0
    Vote Rating
    1
      1  

    Default Issue on focus when dataview has items but no records

    Ext version tested:


    • Ext 6.5.0




    Browser versions tested against:


    • Chrome




    DOCTYPE tested against:


    • HTML5




    Description:

    In Ext.dataview.Abstract#onInnerFocusEnter:

    • Ext.dataview.Abstract#getFirstDataItem() returns null
    • Ext.dataview.Abstract#getFastItems().length returns 1
    • focusPosition.isWidget is called
    • Uncaught TypeError: Cannot read property 'isWidget' of null




    Steps to reproduce the problem:

    https://fiddle.sencha.com/#view/editor&fiddle/21av
    Run and click anywhere in the purple.


    The result that was expected:

    No error


    The result that occurs instead:

    Uncaught TypeError: Cannot read property 'isWidget' of null
    (Ext.dataview.Abstract#onInnerFocusEnter)

  2. #2
    Sencha Premium User
    Join Date
    Jan 2017
    Posts
    12
    Vote Rating
    3
      0  

    Default

    The problem is if the itemCount isn't equals with dataCount, the focusposition maybe is empty.
    For example: dataCount is zero and the empty text is visible, so the itemCount is 1

    I habe made an override to solve this problem. Ext.dataview.Abstract Line 1281.

    Code:
    if (itemCount && focusPosition) {
    instead of
    Code:
    if (itemCount) {

  3. #3
    Sencha Premium User evant's Avatar
    Join Date
    Apr 2007
    Location
    Sydney, Australia
    Posts
    19,236
    Vote Rating
    1015
      0  

    Default

    Thanks for the report! I have opened a bug in our bug tracker.

  4. #4
    Sencha Premium User wemerson.januario's Avatar
    Join Date
    Nov 2008
    Location
    Goiânia - GO, Brazil
    Posts
    867
    Vote Rating
    78
      0  

    Default

    same problem
    Wemerson Januario @JanuarioCoder
    Novanti Tecnologia, Sencha MVP/ Ext JS Consultant
    ____________________________________________
    Hire me on UpWork:

    GitHub
    https://github.com/wemersonjanuario

    Treinamento e Consultoria Ext JS. QUALIFIQUE-SE JÁ!

  5. #5
    Sencha Premium Member
    Join Date
    Feb 2012
    Posts
    94
    Vote Rating
    1
      0  

    Default override creation?

    Quote Originally Posted by WilkenSE View Post
    The problem is if the itemCount isn't equals with dataCount, the focusposition maybe is empty.
    For example: dataCount is zero and the empty text is visible, so the itemCount is 1

    I habe made an override to solve this problem. Ext.dataview.Abstract Line 1281.

    Code:
    if (itemCount && focusPosition) {
    instead of
    Code:
    if (itemCount) {
    Hi
    Could you please provide details of how you created the override - perhaps even post it - and where/what folder structure.
    there is little doco on the web on how to do this and none in sencha doc I can find
    tried various things and nothing so far works.
    regards

  6. #6
    Sencha User
    Join Date
    Dec 2014
    Posts
    11
    Vote Rating
    0
      0  

    Default

    Quote Originally Posted by busaware1 View Post
    Hi
    Could you please provide details of how you created the override - perhaps even post it - and where/what folder structure.
    there is little doco on the web on how to do this and none in sencha doc I can find
    tried various things and nothing so far works.
    regards

    You can use the Ext.override() method and then you can change on it the function you want to override

    Ext.override(Ext.dataview.Abstract,{
    onInnerFocusEnter: function(e) {
    var me = this,
    navigationModel = me.getNavigationModel(),
    focusPosition, itemCount;


    if (navigationModel.lastLocation === 'scrollbar') {
    if (e.relatedTarget) {
    e.relatedTarget.focus();
    }
    return;
    }


    if (e.target === me.getFocusEl().dom) {
    focusPosition = me.restoreFocus && navigationModel.getPreviousLocation();
    if (focusPosition) {
    focusPosition = focusPosition.refresh();
    }
    else if (e.backwards) {
    focusPosition = me.getLastDataItem();
    } else {
    focusPosition = me.getFirstDataItem();
    }
    } else {
    focusPosition = e;
    }


    me.toggleChildrenTabbability(false);
    itemCount = me.getFastItems().length;


    if (itemCount && focusPosition) { <-- I override this line using what WilkenSE posted
    if (focusPosition.isWidget) {
    focusPosition = focusPosition.getFocusEl() || focusPosition.el;
    }


    navigationModel.setLocation(focusPosition, {
    event: e,
    navigate: false
    });
    }


    if (navigationModel.getLocation()) {
    me.el.dom.setAttribute('tabIndex', -1);
    }
    }
    });

  7. #7
    Sencha Premium Member
    Join Date
    Oct 2011
    Location
    Buenos Aires
    Posts
    7
    Vote Rating
    0
      0  

    Default

    Is this bug still not fixed?

  8. #8
    Sencha Premium User
    Join Date
    Jul 2016
    Posts
    7
    Vote Rating
    0
      0  

    Default

    Note this line just before where it blows up:
    > itemCount = me.getFastItems().length; //TODO should this be dataItems?

    I think the answer to that comment is yes. It should be:
    > itemCount = me.dataItems.length;

    Note this other comment in updateItemCls():
    > var items = this.dataItems, //TODO confirm - was getFastItems()

    When I hit this issue itemCount is 1 but that single item is merely the x-empty-text item. It seems getFastItems() returns the empty item whereas the empty item is not present in this.dataItems. (Quite what getFastItems() is for I don't know.)

Similar Threads

  1. Replies: 1
    Last Post: 21 May 2015, 5:43 PM
  2. Getting records from clicked items in DataView
    By coprolit in forum Sencha Touch 1.x: Q&A
    Replies: 1
    Last Post: 17 Nov 2011, 4:51 AM
  3. DataView icon list items issue
    By vaucer in forum Ext: Discussion
    Replies: 0
    Last Post: 19 Jul 2011, 4:52 AM
  4. Replies: 0
    Last Post: 18 Apr 2010, 6:51 PM
  5. DataView Drag Issue: After creating first Portlet into Portal from DataView
    By amitkrgarg in forum Ext 3.x: Help & Discussion
    Replies: 0
    Last Post: 7 Apr 2010, 1:24 PM

Posting Permissions

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