Allow limiting min-depth on tabledrag

Created on 25 September 2018, about 6 years ago
Updated 1 March 2023, over 1 year ago

Motivation

The tabledrag functionality does not allow avoiding a child item to become a root item. This is very useful when there is a differentiation between the root level items, and the ones below. If we have, say, type A and type B, and the business logic implies all B items MUST be children of A items, there is currently no way to allow A items do be drag only among it's sibling A items and at the same time have B items only be draggable inside the A items.

Proposed resolution

Define an attribute to limit the min-depth of a row (and perhaps max-depth also?), making it never move to the side of it's parent leveling.

Remaining tasks

Perhaps adding the same functionality but for max-depth.

API changes

// Define a row's minimum depth.
$form['table'][$row->id()]['#attributes']['data-tabledrag-min-depth'] = 1;
Feature request
Status

Needs work

Version

10.1

Component
Javascript 

Last updated about 13 hours ago

Created by

🇧🇷Brazil lucas.constantino

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024