Uncaught TypeError: Cannot read property 'internalId' of undefined( WHILE SORTING NODES ON


I want to the sort the tree node when it is expanded. I have been struggling to do this in extjs 4.1.0 with itemexpand or beforeItemExpand event using the following code. It works fine in ExtJS 4.2.1.

When I click on node to expand, I get this:

Uncaught TypeError: Cannot read property 'internalId' of undefined at: ns[i].viewRecordId = records[i].internalId in updateIndexes : function(startIndex, endIndex) method of Ext.view.AbstractView class


var mystore = Ext.create('Ext.data.TreeStore', { fields: ['displayName', 'type', 'value', 'stateSize', 'percentOfParent'], root: { "displayName": "state", "name": "state", "stateSize": 1.91, "percentOfParent": 100.0, "percentOfTotalstate": 100.0, "leaf": false, "cls": "highlight-new", "children": [{ "displayName": "Component Tree", "name": "Tree", "stateSize": 0.25, "percentOfParent": 13.0, "percentOfstate": 13.0, "leaf": true, "cls": "highlight-new", "iconCls": "task", }, { "displayName": "crap", "name": "Tree", "stateSize": 0.25, "percentOfParent": 13.0, "percentOfstate": 13.0, "leaf": true, "cls": "highlight-new", "iconCls": "task", }] }); Ext.define('xyz.mytree', { extend: 'Ext.tree.Panel', title: 'State', alias: 'widget.state', width: 150, height: 150, columns: [{ xtype: 'treecolumn', header: 'Name', dataIndex: 'displayName', width: 300 }, { header: 'Type', dataIndex: 'type', width: 275 }, { header: 'Value', dataIndex: 'value', align: 'left', width: 275 }, { header: 'Size (KB)', dataIndex: 'stateSize', align: 'right', width: 95 }, { header: '% Of Parent', dataIndex: 'percentOfParent', align: 'right', width: 95 }], store: mystore, listeners: { itemExpand: function (node) { sortFunction = function (o1, o2) { if (o1.data.displayName < o2.data.displayName) { return -1; } else if (o1.data.displayName > o2.data.displayName) { return 1; } else { return 0; } }; if (!node.expanded) { node.sort(sortFunction, false, false); node.expanded = true; } } }, constructor: function (config) { this.callParent(arguments); } });

In 4.1, if the event used is itemExpand or beforeItemExpand, I receive the above error. But if I use afterItemExpand it works fine. in 4.2.1 it works fine on other events as well...

Any ideas why this is happening? Is there any alternative? Let me know if something is not clear abt the problem Thanks


I got the same issue while using Ext.view.View

So as suggested <a href="https://architectslog.wordpress.com/2013/05/13/sencha-ext-js-4-and-cannot-read-property-internalid-of-undefined/" rel="nofollow">here</a> I changed

itemSelector: 'div'


itemSelector: 'div#someId'

<a href="https://architectslog.wordpress.com/2013/05/13/sencha-ext-js-4-and-cannot-read-property-internalid-of-undefined/" rel="nofollow">https://architectslog.wordpress.com/2013/05/13/sencha-ext-js-4-and-cannot-read-property-internalid-of-undefined/</a>


  • How to specify model name in store of an extjs 4?
  • Nested List not loading in sencha
  • update a nested list in sencha touch 2
  • extjs loading tree from json file using MVC
  • Ruby Multiple OR Evaluations For String Value
  • sqlalchemy map table from mssql database with “prefix-namespaces”
  • How to create directory in php?
  • Retrieve User Stories and associated Test Cases with it
  • PHP OCI8 extensions not working with PHP 7 64 bit
  • How define differents stores for each cell combobox editor in a grid?
  • Contains filter on Microsoft Graph query not working
  • passing parameter from aspx to javascript issue
  • In Laravel how to groupBy Url without parameter in the query
  • How to make image control button for each image inside the div using css and js?
  • ExtJs 4, what is the right way to Delete control from container and Remove it from the memory?
  • How to do custom filtering in Datatables with comma separated values?
  • How to show complete column as editable in extjs grid(cell editing)?
  • MVC: How do you give a viewmodel a list and correctly output it on .cshtml
  • 500 internal server error in ruby on rails
  • Flask-Restful error: “as_view” method not inherited
  • Set comboBox to custom display format
  • Visual Studio 2008 and JavaScript brackets formatting
  • composer dependency stating in doesn't have php-xsl
  • JBoss External Properties Files in Classpath
  • How to use JavaScript to determine whether a file exists in a directory?
  • htaccess add www if not subdomain, if subdomain remove www
  • How can I send an e-mail from a vbs script
  • Sails.js/waterline: Executing waterline queries in toJSON function of a model?
  • Jenkins: How To Build multiple projects from a TFS repository?
  • Can Jackson SerializationFeature be overridden per field or class?
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • how does django model after text[] in postgresql [duplicate]
  • How do I configure my settings file to work with unit tests?
  • Getting Messege Twice Using IMvxMessenger
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs
  • How can i traverse a binary tree from right to left in java?
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app
  • How to load view controller without button in storyboard?