Announcement

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

    TreeGrid.setEditOnF2Keypress (true) not working with 10/26/2012 build

    I click on a record, then click again, but it does not become editable.
    Also, I click on a record, then cilck F2, and the record still does not become editable.

    SmartClient Version: v8.3d_2012-10-22/LGPL Development Only (built 2012-10-22)
    SmartGWT 3.1d-2012-10-26
    GWT 2.3.0
    FF 6.0.2
    IE 9

    Dev console for FF 6.0.2:
    Code:
    14:19:22.958:INFO:Log:initialized
    14:19:28.024:INFO:Log:isc.Page is loaded
    Dev console for IE 9:
    Code:
    14:20:12.471:INFO:Log:initialized
    14:20:12.474:WARN:Page:NOTE: isc.Page.getWidth() called before <BODY> tag was written out -- value cannot be determined.  Returning 500
    14:20:12.474:WARN:Page:NOTE: isc.Page.getHeight() called before <BODY> tag was written out -- value cannot be determined.  Returning 500
    14:20:12.689:INFO:Log:isc.Page is loaded
    Sample code:
    Code:
    import com.smartgwt.client.types.TreeModelType;
    import com.smartgwt.client.widgets.layout.HLayout;
    import com.smartgwt.client.widgets.tree.Tree;
    import com.smartgwt.client.widgets.tree.TreeGridField;
    import com.smartgwt.client.widgets.tree.TreeGrid;
    import com.smartgwt.client.widgets.tree.TreeNode;
    
    import com.google.gwt.core.client.EntryPoint;
    
    public class TreeGridEditOnF2Keypress implements EntryPoint {
    
      // my attributes
      int nextNodeId = 1;
    
      /**
       * The EntryPoint interface
       */
      public void onModuleLoad () {
        
        // configure Tree
        final Tree tree = new Tree ();
        tree.setModelType (TreeModelType.PARENT);
        tree.setNameProperty ("name");
        tree.setIdField ("nodeId");
        tree.setParentIdField ("parentNodeId");
        tree.setShowRoot (true);
    
        final TreeGridField nameField = new TreeGridField ("name", "Name", 200);
    
        // configure TreeGrid
        final TreeGrid treeGrid = new TreeGrid ();
        treeGrid.setWidth (300);
        treeGrid.setHeight (300);
        treeGrid.setEditOnF2Keypress (true);
        treeGrid.setFields (nameField);
        treeGrid.setData (tree);
    
        // add a few nodes, folders and nodes
        addTreeNode (tree, true, "G");
        addTreeNode (tree, false, "F");
        addTreeNode (tree, true, "E");
        addTreeNode (tree, false, "D");
        addTreeNode (tree, true, "C");
        addTreeNode (tree, false, "B");
        addTreeNode (tree, true, "A");
    
        // layout
        final HLayout layout = new HLayout ();
        layout.addMember (treeGrid);
        layout.show ();
      }
    
      /**
       * Helper: uniformely adds the given TreeNode
       * @param tree
       * @param isFolder
       * @param name
       */
      private void addTreeNode (
        final Tree tree,
        final boolean isFolder,
        final String name) {
    
        nextNodeId ++;
    
        final TreeNode treeNode = new TreeNode ();
        treeNode.setAttribute ("nodeId", nextNodeId);
        treeNode.setAttribute ("parentNodeId", 1); // hard-coded
        treeNode.setAttribute ("name", name);
        treeNode.setIsFolder (isFolder);
        final TreeNode rootTreeNode = tree.getRoot ();
        tree.add (treeNode, rootTreeNode);
      }
    }
    So I added this:
    Code:
    treeGrid.setCanEdit (true);
    Then when clicking on a cell and then pressing F2, I started getting the following:
    Code:
    00:07:50.546 [ERROR] Uncaught exception escapedcom.google.gwt.dev.shell.HostedModeException: invoke arguments: JS value of type undefined, expected int
     at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
     at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
     at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:65)
     at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
     at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
     at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
     at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
     at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
     at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
     at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
     at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214)
     at sun.reflect.GeneratedMethodAccessor96.invoke(Unknown Source)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     at java.lang.reflect.Method.invoke(Method.java:597)
     at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
     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)

    #2
    Still the same with SmartGWT 3.1d:
    v8.3d_2012-10-30/LGPL Development Only (built 2012-10-30)

    Comment


      #3
      Still the same with SmartGWT 3.1d:
      v8.3d_2012-11-13/LGPL Development Only (built 2012-11-13)

      Code:
      00:04:05.480 [ERROR] Uncaught exception escapedcom.google.gwt.dev.shell.HostedModeException: invoke arguments: JS value of type undefined, expected int
       at com.google.gwt.dev.shell.JsValueGlue.getIntRange(JsValueGlue.java:266)
       at com.google.gwt.dev.shell.JsValueGlue.get(JsValueGlue.java:144)
       at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:65)
       at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:338)
       at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:219)
       at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:136)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:571)
       at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:279)
       at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
       at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
       at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:242)
       at sun.reflect.GeneratedMethodAccessor64.invoke(Unknown Source)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:597)
       at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
       at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
       at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
       at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
       at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
       at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
       at java.lang.Thread.run(Thread.java:662)
      Let me know if you want me to stop testing this...

      Comment


        #4
        Still not working with
        SmartGWT 3.1p-2012-11-23
        SmartClient Version: v8.3p_2012-11-23/LGPL Development Only (built 2012-11-23)
        Chrome 23, FF 6.0.2

        However, if I add a second field to the tree:
        Code:
            final TreeGridField textField = new TreeGridField ("text", "Text", 200);
            textField.setType (ListGridFieldType.TEXT);
            ...
            treeGrid.setFields (nameField, textField);
        Then, when I click F2 on a row:
        1. The error does not present itself
        2. The new column becomes editable, but not the first

        So I changed the field name from "name" to "xname", and then F2 worked on column #1.
        Full source:
        Code:
        import com.smartgwt.client.types.TreeModelType;
        import com.smartgwt.client.types.ListGridFieldType;
        import com.smartgwt.client.widgets.layout.HLayout;
        import com.smartgwt.client.widgets.tree.Tree;
        import com.smartgwt.client.widgets.tree.TreeGridField;
        import com.smartgwt.client.widgets.tree.TreeGrid;
        import com.smartgwt.client.widgets.tree.TreeNode;
        import com.smartgwt.client.widgets.IButton;
        import com.smartgwt.client.widgets.events.ClickHandler;
        import com.smartgwt.client.widgets.events.ClickEvent;
        
        import com.google.gwt.core.client.EntryPoint;
        import com.google.gwt.core.client.GWT;
        
        public class TreeGridEditOnF2Keypress implements EntryPoint {
        
          // my attributes
          int nextNodeId = 1;
        
          /**
           * The EntryPoint interface
           * http://forums.smartclient.com/showthread.php?t=24124
           */
          public void onModuleLoad () {
        
            // configure Tree
            final Tree tree = new Tree ();
            tree.setModelType (TreeModelType.PARENT);
            tree.setNameProperty ("name");
            tree.setIdField ("nodeId");
            tree.setParentIdField ("parentNodeId");
        
            final TreeGridField nameField = new TreeGridField ("xname", "Name", 200);
            nameField.setType (ListGridFieldType.TEXT);
            
            final TreeGridField textField = new TreeGridField ("text", "Text", 200);
            textField.setType (ListGridFieldType.TEXT);
        
            // configure TreeGrid
            final TreeGrid treeGrid = new TreeGrid ();
            treeGrid.setWidth (500);
            treeGrid.setHeight (300);
            treeGrid.setCanEdit (true);
            treeGrid.setEditOnF2Keypress (true);
            treeGrid.setFields (nameField, textField);
            treeGrid.setData (tree);
        
            // add a few nodes, folders and nodes
            addTreeNode (tree, true, "C");
            addTreeNode (tree, true, "A");
            addTreeNode (tree, false, "B");
            addTreeNode (tree, false, "D");
        
            // add abutton to specifically call startEditing () which seems to throw a different exceptions
            final IButton startEditingButton = new IButton ("startEditing ()");
            startEditingButton.addClickHandler (new ClickHandler () {
              public void onClick (final ClickEvent event) {
                final int rowNum = 1;
                final int colNum = 0;
                final Boolean suppressFocus = null;
                GWT.log ("calling startEditing (" + rowNum + ", " + colNum + ", " + suppressFocus + ")");
                treeGrid.startEditing (rowNum, colNum, suppressFocus);
              }
            });
        
            // layout
            final HLayout layout = new HLayout ();
            layout.addMember (treeGrid);
            layout.addMember (startEditingButton);
            layout.show ();
          }
        
          /**
           * Helper: uniformely adds the given TreeNode
           * @param tree
           * @param isFolder
           * @param name
           */
          private void addTreeNode (
            final Tree tree,
            final boolean isFolder,
            final String name) {
        
            nextNodeId ++;
        
            final TreeNode treeNode = new TreeNode ();
            treeNode.setAttribute ("nodeId", nextNodeId);
            treeNode.setAttribute ("parentNodeId", 1); // hard-coded
            treeNode.setAttribute ("xname", name);
            treeNode.setAttribute ("text", "Text - " + name);
            treeNode.setIsFolder (isFolder);
            final TreeNode rootTreeNode = tree.getRoot ();
            tree.add (treeNode, rootTreeNode);
          }
        }

        Comment

        Working...
        X