Announcement

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

    TreeGrid record edit giving incorrect result

    SmartGWT version : 2.2
    Browsers : All

    I am using a tree grid to display data.

    On double click of a tree node, the node name becomes editable. In the editorexithandler, I am invoking server method to update the name in the list of objects and return back to the client for display.

    When the node name is edited and updated to a new value "Test", the value returned from the server is {"0":"T","1":"e","2":"s","3":"t","4":"t","5":"t","castableTypeMap$":{"1":1,"208":1,"210":1,"213":1}}

    Interesting in dev machines, we are not facing this problem and only in our test server, we are facing the problem.

    Please find below code excerpts:

    // Editor exit handler
    int rowNum = event.getRowNum();

    int id = treeGrid.getRecord(rowNum).getAttributeAsInt("id");
    String oldName = treeGrid.getRecord(rowNum).getAttribute("name");

    String newValue = "";

    if (null != treeGrid.getEditValue(rowNum, event.getColNum())) {
    newValue = treeGrid.getEditValue(rowNum, event.getColNum()).toString();
    }

    if (!oldName.equals(newValue))
    updateName(id,newValue);


    Can somebody please advise on how to solve this ?

    Thanks in advance.
    Last edited by rashika; 24 Jun 2011, 03:57.

    #2
    This is a GWT bug. Please star this issue.

    Cast to String instead of calling toString()

    Code:
    treeGrid.getEditValue(rowNum, event.getColNum()).toString()

    Comment


      #3
      Thanks a lot. Casting to string works.

      Regards

      Comment

      Working...
      X