Announcement

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

    TreeGrid DragDrop reorder issue

    Hi.

    I have an issue with TreeGrid. If I grab a top level record and drop it on the empty area in TreeGrid body, I get an error message about conflicting names, which should be irrelevant.

    I have made an example and checked it with SmartClient 2011-04-14 nightly build.
    Code:
    var tree = Tree.create({
        data: [
            { title: "First", children: [
                { title: "Second" },
            ] },
            { title: "Third", children: [] },
        ]
    });
    
    var grid = TreeGrid.create({
        left: 50,
        top: 50,
        width: 500,
        height: 275,
        canReorderRecords: true,
        canReparentNodes: true,
        fields: [
            { name: "title", title: "Title" },
        ],
        data: tree,
    });
    
    tree.openAll();
    Drag the "first" record and drop it below the last record.
    Expected: the record is moved to the end of the list.
    Result: Error message. Also, a warning in developer console:
    Code:
    15:27:14.951:MUP7:INFO:TreeGrid:isc_TreeGrid_0:already a child named: 0_1 under parent:

    #2
    I was looking through the source code, and I think I found the reason.

    Near the beginning of TreeGrid.getDropFolder there is this line:
    Code:
    eventNode = (eventNode < 0 ? data.getRoot() : data.get(eventRow));
    eventNode is undefined before this line, and changing the condition to eventRow < 0 (defined a few lines above) seemed to fix my original problem.

    Comment


      #3
      A drop in the white space under the tree nodes is intentionally a drop into root. To drop into the last folder position the reorder indicator underneath it instead (like any other folder).

      Comment


        #4
        So I take a node from root and drop it into root (in the white space). I get an error message about duplicate names. That doesn't seem correct, since all nodes have auto-generated unique names.
        I would expect either the node to be moved to end of root's children or nothing happenning at all, but not an error message.

        Comment


          #5
          Please show a runnable test case where this behavior occurs unexpectedly.

          Comment


            #6
            I have attached a html test case. Place the file in SDK folder.
            To reproduce the issue, drag any node from root (e.g. "first") to the empty area below the nodes.
            Attached Files

            Comment


              #7
              It's a tricky case. We'd prefer not to no-op here because that's confusing. Reordering under root would be inconsistent because reorder usually only happens when you actually see a reorder line.

              For now, we don't plan to change this. In the future, we may add a no-drop cursor to clarify this case.

              Comment


                #8
                Have you looked at TreeGrid.getDropFolder?
                It seems to me that there is a coding mistake (initializing eventNode based on the value of eventNode), and fixing it (changing the condition to eventRow) seems to fix the whole issue -- hovering a node in the empty space does show a reorder line and dropping does reorder.

                Comment


                  #9
                  That code does look a little off, thanks for pointing that out. We'll check into it and get back to you.

                  Comment


                    #10
                    Just to let you know this has now been fixed as you suggested.
                    Regards
                    Isomorphic Software

                    Comment

                    Working...
                    X