Announcement

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

    Treenode canEditCell override problem

    Hi!
    I'm trying to only allow editing on leaf nodes through the following code
    Code:
    @Override
    	protected boolean canEditCell(int rowNum, int colNum) {
    		Record rec=this.getEditedRecord(rowNum);
    		if(this.getTree().isFolder(Tree.nodeForRecord(ListGridRecord.getOrCreateRef(rec.getJsObj()))))
    			return false;
    		return super.canEditCell(rowNum, colNum);
    	}
    The problem is that this is causing the app to hang. Apparently this method is getting called several times when I enter edit mode on a folder node(node with children) via double click or setEditOnFocus(true). When I enter edit mode in a leaf node it hits the method multiple times but doesn't hang as when it is a folder node. Could someone tell me what I am doing wrong or how can I achieve the same requirement??
    thanks for your help!

    #2
    Look in your Developer Console and GWT console, your method is almost certainly crashing.

    Comment


      #3
      It's not crashing

      Originally posted by Isomorphic
      Look in your Developer Console and GWT console, your method is almost certainly crashing.
      I've looked around and found no log. Besides, I debugged that method step by step and didn't see any exception being thrown. I thought it was the call to getEditedRecord that was causing a cycle in the call to canEditCell. Now I've tried something different but I had the same result.
      Code:
      @Override
      protected boolean canEditCell(int rowNum, int colNum) {
      	if(this.getTree().isFolder(Tree.nodeForRecord(this.getRecord(rowNum))))
      		return false;
      	return super.canEditCell(rowNum, colNum);
      }
      If I just call the parent method, canEditCell gets called like 8 times but it doesn't cycle.
      Code:
      @Override
      protected boolean canEditCell(int rowNum, int colNum) {
      	return super.canEditCell(rowNum, colNum);
      }
      Is there something I should be aware when extending smartgwt widgets?
      I just did a "public class DatosTreeGrid extends TreeGrid" and tired to overrode the canEditCell in order to disable editing of parent nodes.
      Last edited by cirovladimir; 2 Dec 2009, 09:01.

      Comment


        #4
        No, nothing special. Despite the claim of no errors, there is still almost certainly an error occurring. Try catching Throwable. If you can't figure out what the error is, try putting together a standalone test case.

        Comment


          #5
          Error found

          Originally posted by Isomorphic
          Despite the claim of no errors, there is still almost certainly an error occurring.
          Thanks for your help!
          At last I found the problem.
          I tried to catch throwable and got the same results --no error--
          The problem was my smartgwt-1.3 download, it was corrupted. I download it again and checked its consistency and my application ran smoothly. From now on I should check the hash of IMPORTANT files I download.
          I'm sorry for the inconvenience I may have caused you.

          Comment

          Working...
          X