Using code below, I can access classes of a row that's being dropped:
Drupal.tableDrag.prototype._dropRow = Drupal.tableDrag.prototype.dropRow;
Drupal.tableDrag.prototype.dropRow = function(event, self) {
console.log('dropRow');
console.log("feature-group: " + $(self.rowObject.element).hasClass('feature-group'));
console.log("feature: " + $(self.rowObject.element).hasClass('feature'));
if ( /* use classes here */ ) {
/* return custom result here */
}
/* fallback to default here */
return self._dropRow(event, self);
};
But now I don't want to test classes of a dragged row, but ones of a row that would be a parent. How do I do that?
To clarify: I need tabledrag parent, not DOM parent. All tabledrag rows are DOM siblings, and I need the row with ID field value equal to the would-be Parent ID field value (class="parent"
) of a dragged row.
Something in JavaScript sets the parent ID properly, during either drag or drop (can't tell), so I'm sure there is a way. I just don't know how to find it.