Announcement

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

    TreeGrid canDropOnLeaves: true problem

    Hi Isomorphic,

    please see this modified online testcase (v11.1p_2018-07-14):

    Changed:
    Code:
        isc.PartsTreeGrid.create({
            ID:"myTree1",
            data: partsTree1,
            canReorderRecords: true,
            canAcceptDroppedRecords: true,
    [B]canDropOnLeaves: true,[/B]
            canDragRecordsOut: true,
            dragDataAction: "move"
        }),
    Now, dragging right Bin3/Blue part onto left Bin 1/Blue Cube does not result in an entry under Blue Cube and that one being a folder, which I would expect.

    I did read your docs
    Whether drops are allowed on leaf nodes.

    Dropping is ordinarily not allowed on leaf nodes unless canReorderRecords is set.

    The default action for a drop on a leaf node is to place the node in that leaf's parent folder. This can be customized by overriding folderDrop().

    Note that enabling canDropOnLeaves is usually only appropriate where you intend to add a custom folderDrop() implementation that does not add a child node under the leaf. If you want to add a child nodes to a leaf, instead of enabling canDropOnLeaves, use empty folders instead - see Tree.isFolder() for how to control whether a node is considered a folder.
    but I like the isFolder:false for leaf nodes, so that they don't have a plus icon if empty.
    From how I understand the docs, this should work as I expect, because otherwise having the API canDropOnLeaves does not make sense at all.

    In my application I use a DS with a field for isFolder and a folderDrop-handler (in Java/SmartGWT) and it is behaving like the sample.

    Best regards
    Blama

    #2
    It sounds like the framework is behaving correctly but the canDropOnLeaves property isn't doing what you assumed.

    If you set canReorderRecords to false on the same sample, and leave canDropOnLeaves set to false, when dragging from the right hand grid to the left hand grid you'll see the drop interaction be totally disallowed if the mouse is over a leaf rather than a folder.
    If you set canDropOnLeaves to true, leaving canReorderRecords set to false, dropping on leaves will be allowed, and the behavior will be to put the child into the drop-target node's parent folder.
    If you set canReorderRecords to true, you get basically the same effect as canDropOnLeaves being true except you can drop before or after the drop-target node (reordering the records in the grid).

    In either of the above cases you could implement a custom folderDrop handler to change the default behavior (dropping the child into the parent folder).

    However it sounds like what you want is to simply have all the nodes be folders, but get rid of the opener icon ("+"/"-") on any nodes without children.
    This should be as simple as setting alwaysShowOpener to false on the TreeGrid.
    You also may want to suppress or modify the folder/file icon that shows up next to the nodes by default. There are various properties to control the icon to display, including TreeGrid.nodeIcon, TreeGrid.folderIcon, TreeNode.icon, etc

    Regards
    Isomorphic Software

    Comment

    Working...
    X