ExtJs 4 - Cannot call method 'substring' of undefined

Well there could be various reasons you are getting this error, but the most common fix is to check the following...
  1. Make sure the xtype is defined as an alias
  2. Check the alias and the xtype spelling
  3. Check if the view was defined in the controller

Snippet from the Sencha docs about xtype

The xtype configuration option can be used to optimize Component creation and rendering. It serves as a shortcut to the full component name. For example, the component Ext.button.Button has an xtype of button.

You can define your own xtype on a custom component by specifying the alias config option with a prefix of widget. For example:
Ext.define('PressMeButton', {
    extend: 'Ext.button.Button',
    alias: 'widget.pressmebutton',
    text: 'Press Me'

Any Component can be created implicitly as an object config with an xtype specified, allowing it to be declared and passed into the rendering pipeline without actually being instantiated as an object. Not only is rendering deferred, but the actual creation of the object itself is also deferred, saving memory and resources until they are actually needed. In complex, nested layouts containing many Components, this can make a noticeable improvement in performance.
// Explicit creation of contained Components:
var panel = new Ext.Panel({
   items: [
      Ext.create('Ext.button.Button', {
         text: 'OK'

// Implicit creation using xtype:
var panel = new Ext.Panel({
   items: [{
      xtype: 'button',
      text: 'OK'

In the first example, the button will always be created immediately during the panel's initialization. With many added Components, this approach could potentially slow the rendering of the page. In the second example, the button will not be created or rendered until the panel is actually displayed in the browser.

If the panel is never displayed (for example, if it is a tab that remains hidden) then the button will never be created and will never consume any resources whatsoever.

No comments:

Post a Comment

NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.