SelectBox "script block" error

  1. #1

    SelectBox "script block" error

    Hello,
    I am encountering an error in the Visual Studio IDE in a "script block" that looks like it is generated by Ext.Net. I have no idea where it gets loaded as i cannot find any of the source on disk. The script block is shown below and is shown in a "script block" container in the Visual Studio IDE tree view in Solution Explorer. This code errors out at
                this.lastSelectedIndex = this.getStore().indexOf(records[0]) + 1;
    as there is no
    records
    variable available. I have also attached a screen shot for clarity. What is the best way around this error?

    Ext.define('Ext.ux.SelectBox', {
        extend: "Ext.form.field.ComboBox",
        alias: "widget.selectbox",
    
        constructor: function (config) {
            this.searchResetDelay = 1000;
            config = Ext.merge(config || {}, {
                editable: false,
                forceSelection: true,
                rowHeight: false,
                lastSearchTerm: "",
                triggerAction: "all",
                queryMode: "local",
                listConfig: {
                    navigationModel: "boundlistselectbox",
                    listeners: {
                        refresh: {
                            fn: this.calcRowsPerPage,
                            scope: this,
                            delay: 100
                        },
                        afterRender: function () {
                            this.listEl.unselectable();
                        },
                        itemmouseenter: {
                            fn: function (view, record, node, index) {
                                this.lastSelectedIndex = index + 1;
                                this.cshTask.delay(this.searchResetDelay);
                            },
                            scope: this
                        }
                    }
                }
            });
    
            this.callParent([config]);
            this.lastSelectedIndex = this.selectedIndex || 0;
            this.on("select", function (combo, records) {
                this.lastSelectedIndex = this.getStore().indexOf(records[0]) + 1;
            });
    
            if (Ext.isChrome) {
                this.on("expand", function () { this.focus(); }); // for some reason, it doesn't happen automatically in Chrome
            }
        }
    Attached Thumbnails Click image for larger version. 

Name:	JavascriptCodeBlock.png 
Views:	103 
Size:	72.4 KB 
ID:	25306  
  2. #2
    I am assuming it is being dynamically loaded by the Ext.net dll and it is defining the SelectBox. How can i avoid this error?
  3. #3
    Its ok, i created my own selectbox and it works fine now...the selectbox code in the Ext.Net dll should read
       this.on( "select", function ( combo, records )
                {
                    if ( records )
                    {
                        this.lastSelectedIndex = this.getStore().indexOf( records[0] ) + 1;
                    }
                } );
    instead of the existing code which is
       this.on( "select", function ( combo, records )
                {
                    this.lastSelectedIndex = this.getStore().indexOf( records[0] ) + 1;
                } );
  4. #4
    Thanks for the update. We will look into adding this records check to the SelectBox.
    Geoffrey McGill
    Founder

Similar Threads

  1. [CLOSED] The function "addScript" causing the error "Syntax Error"
    By Woyciniuk in forum 3.x Legacy Premium Help
    Replies: 22
    Last Post: Sep 26, 2015, 8:56 AM
  2. [CLOSED] "Stop running script" message in IE 8 in line chart
    By PriceRightHTML5team in forum 2.x Legacy Premium Help
    Replies: 3
    Last Post: Apr 24, 2014, 5:54 AM
  3. Replies: 1
    Last Post: Sep 09, 2012, 5:12 PM
  4. [CLOSED] SelectBox: Problem with characters "<" and ">"
    By nhg_itd in forum 1.x Legacy Premium Help
    Replies: 4
    Last Post: Nov 03, 2011, 6:43 AM
  5. Replies: 16
    Last Post: Oct 15, 2010, 10:04 AM

Tags for this Thread

Posting Permissions