Jump to content

Recommended Posts

Posted

Overview

  • Implements drag-and-drop from TUniTreeView to TUniStringGrid.

  • All JavaScript logic is kept in a separate file:

files/initTreeToGridDnD.js

Selection Behavior

  • Multi-selection enabled (MULTI).

  • toggleOnClick = true → Ctrl+Click adds/removes nodes.

  • allowDeselect = true → click on a selected node clears selection.

  • Shift+Click selects a range.

  • Plain click keeps only one node selected.

Drag & Drop

  • Drag:

    • If dragged node is selected → drag all selected.

    • If not → drag only that node.

  • Drop:

    • Inserts node texts into the target TUniStringGrid cell.

    • Sends cell_changed to the server.

  • Move (delete in tree):

    • Copy by default.

    • If moveOnCtrl = true → only moves when Ctrl is pressed.

    • Sends move_nodes IDs to the server, deletion is confirmed server-side.

Server-side (Delphi)

  • UniStringGrid1AjaxEvent → updates grid cell (cell_changed).

  • UniTreeView1AjaxEvent → deletes tree nodes (move_nodes) and syncs client with removeTreeNodesByIds.

  • Initialization:

UniSession.AddJS(
  Format('initTreeToGridDnD(%s,%s,%s);',
    [UniTreeView1.JSName, UniStringGrid1.JSName, 'true'])
);

initTreeToGridDnD.zip

  • Like 1
Posted

Thank you! Maybe some days we could find implementation of TUniDBTreeGrid and simply TUniTreeView :)

I have own solution for DBTree, but it works not very well.

  • 6 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...