Results 1 to 2 of 2

Thread: "this.indexOf is not a function" error with 3.4.0 and creating a

    Thank you for reporting this bug. We will make it our priority to review this report.
  1. #1
    Sencha User
    Join Date
    Mar 2010
    Vote Rating

    Default "this.indexOf is not a function" error with 3.4.0 and creating a

    Hi there,

    I have an error happening with my It appears the menu's "remove" method is somehow being sent over to the Array.prototype's remove method, which calls "this.indexOf", which isn't defined for the menu. This below code works in 3.3.1, but errors out in 3.4.0:

      <title>Sample Widget Test</title>
        <link rel="stylesheet" type="text/css" href="/js/ext-3.4.0/resources/css/ext-all.css"/>
          <script  src="/js/ext-3.4.0/adapter/ext/ext-base-debug.js"></script>
        <script  src="/js/ext-3.4.0/ext-all-debug.js"></script>
          <script type = "text/javascript">
              MyApp.ReviewHeader = Ext.extend(Ext.Container, {
                  initComponent: function() {
                      Ext.apply(this, {
                          height: 45,
                          html: 'My Custom Container',
                          mybuttons: [{
                            text: 'Tools',
                            id: 'my-tools',
                            iconCls: 'white-wrench-icon',
                            mymenu: new
                  getToolsMenu: function() {
                      var tools = [{
                          text: "Finish Review",
                          id: 'tools-finish',
                          handler: Ext.emptyFn,
                          icon: 'img/16/award_star_bronze_3.png'
                      return tools;
            Ext.onReady(function() {
                var w = new Ext.Window({
                    title: 'Sample Widget Window',
                    width: 800,
                    height: 600,
                    items: [
                        new MyApp.ReviewHeader(),
                        new Ext.Panel({
                              title: 'Sample Title',
                              html: 'Sample Test Panel'
    The above code is greatly simplified from my actual usage, but still shows the error I'm seeing.

    I can make the code work by applying the following override:

            Ext.override(, {
                getMenuItem: function(config) {
                    //config.ownerCt = this;
                    if (!config.isXType) {
                        if (!config.xtype && Ext.isBoolean(config.checked)) {
                            return new;
                        return Ext.create(config, this.defaultType);
                    return config;
    Here I'm commenting out "config.ownerCt = this", which is a line that was added between 3.3.1 and 3.4.0. Obviously, though, I'm not sure of the ramifications of this line. I had seen a few changes related to menus and ownerCts.

    Is this a known bug? Am I doing something bad to mess it up? Is this an okay override?

    Thanks Sencha! I love Ext!

  2. #2
    Sencha User
    Join Date
    Mar 2010
    Vote Rating


    After digging through code a little more, I found a better way to get this working. Pass the menu items array in as the "items" attribute of a configuration object:

    mymenu: new{
        items: this.getToolsMenu()
    It appears that this issue only happens when an is created with an array as its solo constructor argument. I guess this sort of begins to explain how since an array has the "remove" prototype method, if you pass that as the configuration for a container, it might take and override its own "remove" method. However, it doesn't jump out at me as to why the code changes for 3.4 broke this.

    Anyway, the constructor documentation doesn't say that an array is a valid constructor argument, so perhaps this won't be considered a bug. I'm not sure which one of our developers wrote this code, but they had reason to believe it took an array (perhaps one of the old examples showed this?), and the code is definitely trying to handle the case of an array being passed in, so something isn't quite working right.

    Hope this helps the next person who stumbles across this issue!

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