Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Platform tree table drag and drop improvements #9421

Closed
mikerodonnell89 opened this issue Feb 20, 2023 · 1 comment · Fixed by #9626
Closed

Platform tree table drag and drop improvements #9421

mikerodonnell89 opened this issue Feb 20, 2023 · 1 comment · Fixed by #9626
Assignees
Labels
enhancement New feature or request High priority

Comments

@mikerodonnell89
Copy link
Member

Currently you can only drag and drop tree table rows into other rows - they cannot be dropped next to (i.e. before or after). We need both this behavior as well as a way to make this visually distinct. I think the ideas around @Input() replaceMode behavior can be expanded upon to make this happen.

@fkolar
Copy link
Member

fkolar commented Mar 29, 2023

While back when I was implementing this behavior, I extracted all this into directive to handle this.

<ng-template #rowTemplate let-rowData let-even="event" let-odd="odd" let-rowIndex="rowIndex"
             let-nestingLevel="nestingLevel" let-colsToRender="colsToRender">


    <tr #rowElement dtDraggableRow [dndRowIndex]="rowIndex" [dndRowData]="rowData"
        [dropIntoEnabled]="(rowData.metaId && dataMeta[rowData.metaId]) ? dataMeta[rowData.metaId].dropIntoEnabled :
            ((!rowData.metaId && dataMeta[rowData]) ? dataMeta[rowData].dropIntoEnabled : false)"
        class="dt-body-row"
        ....
        [ngClass]="{'dt-even-row': even, 'dt-odd-row': odd,
            ...
            'dt-row-draggable':....,>

        <ng-template ngFor let-col [ngForOf]="colsToRender" let-colIndex="index" [ngForTrackBy]="trackByIndex">
             ....
        </ng-template>
    </tr>
</ng-template>

This directive dtDragableRow, aggregated all the behaviour related to D2D.
https://github.wdf.sap.corp/core-ui-platform/AribaCoreUI/blob/v11.0.17/packages/components/src/widgets/datatable2/directives/dt-draggable-row.directive.ts

  • was checking the direction so I can apply correct styles
  • Drag/Drop position. - inBetween, Before, After, Into
  • Apply proper styles to create a effect and visualise better the drop zone

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request High priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants