Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    "this.newInstance is not a function" when Menu has initialCriteria

    1. SmartClient Version: v8.2p_2012-10-25/LGPL Development Only (built 2012-10-25)

    2. FF 3.6.17

    3. -

    4. -

    5.
    Code:
    00:03:16,521 [ERROR] 10:02:25.325:MUP9:WARN:Log:TypeError: this.newInstance is not a function unnamed() @ sc/modules/ISC_Grids.js:20 Menu._makeDynamicItemsFunction() @ sc/modules/ISC_Grids.js:3519 Menu._observeData({Obj}) @ sc/modules/ISC_Grids.js:3431 ListGrid.setData(_1=>{Obj}, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef) @ sc/modules/ISC_Grids.js:1171 Class.invokeSuper(_1=>{Obj}, _2=>"setData", _3=>{Obj}, _4=>undef, _5=>undef, _6=>undef) @ sc/modules/ISC_Core.js:294 Menu.setData({Obj}) @ sc/modules/ISC_Grids.js:3480 Canvas.filterWithCriteria({Obj}, {Obj}, {Obj}) @ sc/modules/ISC_Core.js:3664 Canvas._filter("fetch", {Obj}, null, {Obj}) @ sc/modules/ISC_Core.js:3661 Class.invokeSuper(_1=>null, _2=>"$wo") @ sc/modules/ISC_Core.js:294 Class.Super(_1=>"$wo", _2=>[object Array], _3=>{Obj}) @ sc/modules/ISC_Core.js:286 ListGrid._filter("fetch", {Obj}, null, {Obj}) @ sc/modules/ISC_Grids.js:2312 Canvas.fetchData({Obj}, null, {Obj}) @ sc/modules/ISC_Core.js:3633 Canvas.doInitialFetch() @ sc/modules/ISC_Core.js:3648 Canvas.draw(undef, undef, undef, undef, undef, undef, undef, undef) @ sc/modules/ISC_Core.js:2130 Class.invokeSuper(_1=>{Obj}, _2=>"draw", _3=>undef, _4=>undef, _5=>undef, _6=>undef) @ sc/modules/ISC_Core.js:294 ListGrid.draw() @ sc/modules/ISC_Grids.js:1512 Menu._showOffscreen() @ sc/modules/ISC_Grids.js:3469 unnamed() @ sc/modules/ISC_Grids.js:3575 unnamed({Obj}, undef) @ sc/modules/ISC_Grids.js:3571 [c]EventHandler.bubbleEvent(_1=>{Obj}, _2=>"click") @ sc/modules/ISC_Core.js:1669 [c]EventHandler.handleClick(_1=>{Obj}) @ sc/modules/ISC_Core.js:1504 EventHandler._handleMouseUp([object MouseEvent], undef) @ sc/modules/ISC_Core.js:1490 [c]EventHandler.handleMouseUp(_1=>[object MouseEvent]) @ sc/modules/ISC_Core.js:1481 [c]EventHandler.dispatch(_1=>isc_c_EventHandler_handleMouseUp, _2=>[object MouseEvent]) @ sc/modules/ISC_Core.js:1732 anonymous([object MouseEvent]) @ sc/modules/ISC_Core.js:39 unnamed() @
    com.smartgwt.client.core.JsObject$SGWT_WARN: 10:02:25.325:MUP9:WARN:Log:TypeError: this.newInstance is not a function     unnamed() @ sc/modules/ISC_Grids.js:20     Menu._makeDynamicItemsFunction() @ sc/modules/ISC_Grids.js:3519     Menu._observeData({Obj}) @ sc/modules/ISC_Grids.js:3431     ListGrid.setData(_1=>{Obj}, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef, undefined=>undef) @ sc/modules/ISC_Grids.js:1171     Class.invokeSuper(_1=>{Obj},  _2=>"setData",  _3=>{Obj},  _4=>undef,  _5=>undef,  _6=>undef) @ sc/modules/ISC_Core.js:294     Menu.setData({Obj}) @ sc/modules/ISC_Grids.js:3480     Canvas.filterWithCriteria({Obj}, {Obj}, {Obj}) @ sc/modules/ISC_Core.js:3664     Canvas._filter("fetch", {Obj}, null, {Obj}) @ sc/modules/ISC_Core.js:3661     Class.invokeSuper(_1=>null,  _2=>"$wo") @ sc/modules/ISC_Core.js:294     Class.Super(_1=>"$wo",  _2=>[object Array],  _3=>{Obj}) @ sc/modules/ISC_Core.js:286     ListGrid._filter("fetch", {Obj}, null, {Obj}) @ sc/modules/ISC_Grids.js:2312     Canvas.fetchData({Obj}, null, {Obj}) @ sc/modules/ISC_Core.js:3633     Canvas.doInitialFetch() @ sc/modules/ISC_Core.js:3648     Canvas.draw(undef, undef, undef, undef, undef, undef, undef, undef) @ sc/modules/ISC_Core.js:2130     Class.invokeSuper(_1=>{Obj},  _2=>"draw",  _3=>undef,  _4=>undef,  _5=>undef,  _6=>undef) @ sc/modules/ISC_Core.js:294     ListGrid.draw() @ sc/modules/ISC_Grids.js:1512     Menu._showOffscreen() @ sc/modules/ISC_Grids.js:3469     unnamed() @ sc/modules/ISC_Grids.js:3575     unnamed({Obj}, undef) @ sc/modules/ISC_Grids.js:3571     [c]EventHandler.bubbleEvent(_1=>{Obj},  _2=>"click") @ sc/modules/ISC_Core.js:1669     [c]EventHandler.handleClick(_1=>{Obj}) @ sc/modules/ISC_Core.js:1504     EventHandler._handleMouseUp([object MouseEvent], undef) @ sc/modules/ISC_Core.js:1490     [c]EventHandler.handleMouseUp(_1=>[object MouseEvent]) @ sc/modules/ISC_Core.js:1481     [c]EventHandler.dispatch(_1=>isc_c_EventHandler_handleMouseUp,  _2=>[object MouseEvent]) @ sc/modules/ISC_Core.js:1732     anonymous([object MouseEvent]) @ sc/modules/ISC_Core.js:39     unnamed() @       at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)     at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)     at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)     at java.lang.reflect.Constructor.newInstance(Constructor.java:513)     at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:105)     at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)     at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)     at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)     at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)     at java.lang.Thread.run(Thread.java:662)
    6.
    Code:
    package pl.com.tech4.client;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.google.gwt.core.client.GWT;
    import com.smartgwt.client.core.KeyIdentifier;
    import com.smartgwt.client.data.Criteria;
    import com.smartgwt.client.util.KeyCallback;
    import com.smartgwt.client.util.Page;
    import com.smartgwt.client.util.SC;
    import com.smartgwt.client.widgets.menu.IMenuButton;
    import com.smartgwt.client.widgets.menu.Menu;
    
    public class MainEntryPoint implements EntryPoint {
       
        FieldDS schemaDS;
        Criteria initialCriteria = new Criteria();
           
        public void onModuleLoad() {
    
            if (!GWT.isScript()) {
                KeyIdentifier debugKey = new KeyIdentifier();
                debugKey.setCtrlKey(true);
                debugKey.setKeyName("Y");
                Page.registerKey(debugKey, new KeyCallback() {
    
                    public void execute(String keyName) {
                        SC.showConsole();
                    }
                });
            }
           
            initialCriteria.addCriteria("name", "a");
            schemaDS = new FieldDS();
            layout();
        }
       
        private void layout() {
           
            Menu fieldsMenu = new Menu();
            fieldsMenu.setDataSource(schemaDS);
            fieldsMenu.setInitialCriteria(initialCriteria);
            fieldsMenu.setAutoFetchData(true);
           
            IMenuButton fieldsButton = new IMenuButton("Fields");
            fieldsButton.setMenu(fieldsMenu);
                   
            fieldsButton.draw();
        }
    
    }
    Code:
    package pl.com.tech4.client;
    
    import com.smartgwt.client.data.DataSource;
    import com.smartgwt.client.data.fields.DataSourceIntegerField;
    import com.smartgwt.client.data.fields.DataSourceTextField;
    import com.smartgwt.client.types.DSDataFormat;
    
    public class FieldDS extends DataSource {
    
        public FieldDS() {
    
            setDataFormat(DSDataFormat.XML);
            setDataURL("schemaDS.xml");
            setClientOnly(true);
    
            DataSourceIntegerField idField = new DataSourceIntegerField("ordinal");
            idField.setPrimaryKey(true);
            DataSourceTextField nameField = new DataSourceTextField("name");
            DataSourceTextField titleField = new DataSourceTextField("title");
            setFields(idField, nameField, titleField);
        }
    
    }
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <root>
        <panel>
            <ID>CompanyGroupDir</ID>
            <dataSource>
                <titleField>code</titleField>
            </dataSource>
            <valuesManager>
                <dynamicForm ordinal="0">
                    <numCols>4</numCols>
                </dynamicForm>
            </valuesManager>
            <field ordinal="0" useInSave="true">
                <name>id</name>
                <title>ID</title>
                <type>sequence</type>
                <primaryKey>true</primaryKey>
                <canEdit>false</canEdit>
                <canFilter>false</canFilter>
                <hidden>true</hidden>
            </field>
            <field ordinal="1" useInSave="true">
                <name>aclGroup</name>
                <title>ACL Group</title>
                <type>text</type>
                <canEdit>false</canEdit>
                <canFilter>false</canFilter>
                <hidden>true</hidden>
            </field>
            <field ordinal="2" useInSave="true">
                <name>version</name>
                <title>Version</title>
                <type>integer</type>
                <canEdit>false</canEdit>
                <canFilter>false</canFilter>
                <hidden>true</hidden>
            </field>
            <field ordinal="3" useInSave="true">
                <name>code</name>
                <title>Code</title>
                <type>text</type>
                <required>true</required>
                <length>20</length>
                <formField>
                    <endRow>true</endRow>
                </formField>
            </field>
            <field ordinal="4" useInSave="true">
                <name>description</name>
                <title>Description</title>
                <type>text</type>
                <length>60</length>
                <formField>
                    <width>*</width>
                    <colSpan>3</colSpan>
                </formField>
            </field>
            <field ordinal="5" useInSave="true">
                <name>validFrom</name>
                <title>Valid from</title>
                <type>date</type>
            </field>
            <field ordinal="6" useInSave="true">
                <name>validTo</name>
                <title>Valid to</title>
                <type>date</type>
            </field>
        </panel>
    </root>
    Attempt to click menu button produces js error as above.
    If I use ListGrid in place of Menu then this code works as expected.
    MichalG
Working...
X