Results 1 to 9 of 9

Thread: "Cannot call method down of null" error on updating my list store

  1. #1
    Sencha User
    Join Date
    Nov 2011
    Posts
    72
    Answers
    3
    Vote Rating
    2
      1  

    Default "Cannot call method down of null" error on updating my list store

    I have 2 stores. When the first (store A) is loaded, I start loading the other (store from the 'refresh' event of store A. I first copy store A into store B then modify some stuff in it by calling store.each to apply modification on every record.
    But this line breaks everything and I don't get why :
    record.set('name', 'some name');

    My record do have a name property but whatever the property i try to set, I get an error in this sencha touch function where item comes in undefined and then extItem becomes null (which at least explains the error 'down of null') :

    updateListItem: function(record, item) {

    var me = this,
    dataview = me.dataview,

    extItem = Ext.fly(item),
    innerItem = extItem.down(me.labelClsCache, true),
    data = record.data,
    disclosureProperty = dataview.getDisclosureProperty(),
    disclosure = data && data.hasOwnProperty(disclosureProperty),
    iconSrc = data && data.hasOwnProperty('iconSrc'),
    disclosureEl, iconEl;

  2. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3932
    Vote Rating
    1272
      0  

    Default

    Do you have a test case?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    Nov 2011
    Posts
    72
    Answers
    3
    Vote Rating
    2
      0  

    Default

    I'll try adding one tonight or tomorrow !

  4. #4
    Sencha User
    Join Date
    Nov 2011
    Posts
    72
    Answers
    3
    Vote Rating
    2
      0  

    Default

    I can't reproduce it with a simpler test case. This issue is not showing and the refresh event does work with the setter inside it and all...
    I guess there was something wrong in my code...
    I changed it completely to avoid doing this.

  5. #5
    Sencha User
    Join Date
    Jul 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default I am seeing the same issue

    This bug definite exists, however it doesn't always happen all the time, but when it does, it will repro everytime the store is refreshed.

    The issue is here

    onStoreUpdate: function(store, record, newIndex, oldIndex) {
    var me = this,
    container = me.container;
    oldIndex = (typeof oldIndex === 'undefined') ? newIndex : oldIndex;




    if (oldIndex !== newIndex) {
    container.moveItemsToCache(oldIndex, oldIndex);
    container.moveItemsFromCache([record]);
    }
    else {
    // Bypassing setter because sometimes we pass the same record (different data)
    container.updateListItem(record, container.getViewItems()[newIndex]);
    }
    }

    container.getViewItems()[newIndex] return an undefined item, that's why it throws an error when the code try to call .down inside updateListItem
    var me = this,
    dataview = me.dataview,
    extItem = Ext.fly(item),
    innerItem = extItem.down(me.labelClsCache, true),

  6. #6
    Sencha User
    Join Date
    Jun 2013
    Posts
    45
    Answers
    1
    Vote Rating
    4
      0  

    Default

    I get this as well, when rejecting changes to a record.

    It happens in

    Code:
    afterReject: function(record) {
            var index = this.data.indexOf(record);
            this.fireEvent('updaterecord', this, record, index, index, [], {});
        },
    For some reason, it is not finding the record in the store's data, and then returns -1 which leads to the eventual error in updateListItem.

    If I change the first line from
    Code:
    this.data.indexOf(record)
    to

    Code:
    this.data.all.indexOf(record)
    or

    Code:
    this.data.items.indexOf(record)
    it works.


    Is this issue fixed in more recent version of Sencha Touch? The codebase I am working in is using 2.0.0

  7. #7
    Sencha User
    Join Date
    Jun 2013
    Posts
    45
    Answers
    1
    Vote Rating
    4
      0  

    Default

    Bump: anyone solved this?

  8. #8
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    100
    Answers
    1
    Vote Rating
    15
      0  

    Default Cannot call method down of null...

    Same (my) code, different js, different result:

    Using ExtJs 4.2.2 with ext/ext-dev.js error found.
    With ExtJs 4.2.2 with path/ext-all-debug-w-comments.js error NOT FOUND!
    With ExtJs 4.2.2 with ext/ext-all.js error found....

    Why?

  9. #9
    Ext JS Premium Member
    Join Date
    Sep 2008
    Posts
    100
    Answers
    1
    Vote Rating
    15
      0  

    Default Idea

    This can help to find a solution:

    on click in a button extjs create a locked grid (ExtJs 4.2.2) i have a store with group feature, so the first time i load the store all go right.
    The second time i click on the same button the grid is create this error appear (cannot call method down of null).
    If i delete groupField on store config all go right but without group feature...

    Line error in Table.js:2250
    return (me.isGrouping ? Ext.fly(item) : this.el).down('table.x-grid-table');

    Anyone can help me?

Posting Permissions

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