Announcement

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

    #16
    I have made the changes you requested.
    Everything on the form item is done in the context of the onIconClick event.
    I'm still seeing the same behavior with creating a new grid row (startEditingNew).

    This works perfectly with existing grid records.

    When creating a new record/grid row...

    1. If I bring up the grid and add a row, everything works fine.
    The form displays the new value I selected.
    Up until the save (carriage return).
    At that point, the grid returns "Unknown" in the time field.
    This is the default empty cell value.
    At that point the record cannot be selected.

    2. If I edit the existing test record first and change the time.
    The edit of the existing record works perfectly.
    When I then open a new row, the grid has somehow put a date in the time cell with a value of the beginning of the epoch (Jan 1, 1970 12:00 AM).
    I can change that value with the picker but when I save the new row, it reverts back to the original value (12:00 AM).

    At that point, I get the following error...
    Code:
    08:56:50.774 [ERROR] [SGWT_test] 08:56:50.799:TMR1:WARN:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):getRange(2, 3): start beyond end of rows, returning empty list
    
    com.smartgwt.client.core.JsObject$SGWT_WARN: 08:56:50.799:TMR1:WARN:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):getRange(2, 3): start beyond end of rows, returning empty list
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        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:172)
        at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:292)
        at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:546)
        at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
        at java.lang.Thread.run(Unknown Source)
    I'm obviously doing something stupid here but it looks to me that the grid doesn't recognize the custom form as being the object it should be pulling it's value from.

    I have attached the updated test case.
    You can use the icons I posted earlier if you need to.
    Attached Files

    Comment


      #17
      Need to update this a bit.

      It seems the only time I get the "beyond end of rows" error I listed above is if there was a failed attempt (i.e. "Unknown" time value) in the grid.
      Looks like the grid is adding a new row index but when it comes time to save it, it doesn't see the failed attempt row as a valid row index.

      Comment


        #18
        The problem here turns out to be a subtle problem with the framework (not exactly a bug but a tricky requirement).
        In order for the ListGrid to pick up the edit from the form item, it needs to know the user is currently editing that item, which is handled by checking for the item receiving user focus.
        In this use case the developer hits the icon to show the picker, and the picker populates the field value but the item never actually gets keyboard focus.

        A quick fix / workaround for this in your code is to change the "set" button click handler to explicitly put focus into the item when it changes the value:
        Code:
              Button set = new Button("Set");
              set.addClickHandler(new ClickHandler()
              {
                @Override
                public void onClick(ClickEvent event)
                {
                  Date d = getData();
                  System.out.println("In Picker Set onClick with: "+d);
                  editForm.setValue(d);
                  editForm.setAttribute("time", d);          
                  hide();
                  editForm.focusInItem();
                }
              });
        We'll look into whether there's a way to restructure things internally so this isn't required (though it's likely this will not change in the immediate future).

        Regards
        Isomorphic Software

        Comment

        Working...
        X