If you use the #empty property on a table, tabledrag isn't smart enough to hide the table's weight column if table is empty. This is because the "empty" text is displayed with a colspan that takes up the whole row, and tabledrag relies on a class that is only added to the weight column. That column doesn't exist in the table body when the colspan is in effect, hence tabledrag can't find the class and does nothing.

An easy way to fix this is to add the magic class to the weight column in the table header.

We use tabledrag when editing Reaction Rules and Rules Components, in both the Conditions block and the Actions block, to enable us to re-order the conditions and/or actions in the rule. This problem is apparent when first creating the rule, because at that time both the Conditions and Actions will be empty, but it is also seen when you have a Rule that has no conditions.

CommentFileSizeAuthor
tabledrag-hide-weight-when-empty.patch1.29 KBtr

Comments

TR created an issue. See original summary.

  • TR committed dd1ce4d on 8.x-3.x
    Issue #3105960 by TR: tabledrag doesn't hide weight column if table is...
tr’s picture

Status: Needs review » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.