Results 1 to 6 of 6

Thread: Uncaught Error: DOM element with id x in Element cache is not same as element in DOM

  1. #1
    Sencha User
    Join Date
    Feb 2016
    Posts
    16

    Default Uncaught Error: DOM element with id x in Element cache is not same as element in DOM

    I've the following code in UI on the button Click event, which is returning an MS-Excel file. It works perfectly in first try but, return the following error after second, third and .... clicks.

    Any suggestions, how can I get rid of it?

    ERROR: "Uncaught Error: DOM element with id iframe in Element cache is not the same as element in the DOM. Make sure to clean up Element instances using destroy()"

    Code:
    {var body = Ext.getBody();
    var frame = body.createChild({tag:'iframe'
    ,cls:'x-hidden'
    ,id:'iframe'
    ,name:'iframe'
    });
    
    var form = body.createChild({
     tag:'form'
    ,cls:'x-hidden'
    ,id:'form'
    ,params: cloneExportObject
     ,method: 'post'
    ,action:link
    ,target:'iframe'
    ,enctype: 'application/x-www-form-urlencoded'
    ,encoding: 'application/x-www-form-urlencoded'
    });
    
    var hiddenItem1 = document.createElement('input');
    Ext.fly(hiddenItem1).set({
    type: 'hidden',
    value: cloneExportObject.securityId,
    name: 'securityId'
    });
    form.appendChild(hiddenItem1);
    
    var hiddenItem2 = document.createElement('input');
    Ext.fly(hiddenItem2).set({
    type: 'hidden',
    value: cloneExportObject.uniqueSearchId,
    name: 'uniqueSearchId'
    });
    form.appendChild(hiddenItem2);
    
    form.dom.submit();}
    Thanks!

  2. #2
    Sencha User
    Join Date
    Apr 2013
    Posts
    913
    Answers
    105

    Default

    You are adding multiple elements with same IDs. Reuse existing elements or remove the old ones before creating new.

  3. #3
    Sencha User
    Join Date
    Feb 2016
    Posts
    16

    Default

    Thanks, I tried the destroy() method but, it's not working. do you know which one to remove exactly and how? a small code snippet would be really helpful.

    Thanks!

  4. #4
    Sencha User
    Join Date
    Apr 2013
    Posts
    913
    Answers
    105

    Default

    Code:
    var frame = Ext.get('iframe') ||  body.createChild(..);

  5. #5
    Sencha User
    Join Date
    Feb 2016
    Posts
    16

    Default

    Thanks, but it's not working.

  6. #6
    Sencha User
    Join Date
    Apr 2013
    Posts
    913
    Answers
    105

    Default

    Create a Sencha fiddle to show what's exactly not working.

Similar Threads

  1. Replies: 0
    Last Post: 3 Aug 2011, 3:10 PM
  2. Replies: 1
    Last Post: 12 Apr 2011, 12:27 AM
  3. Replies: 6
    Last Post: 12 Jan 2010, 3:46 AM

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
  •