The problem is this line:

    $('form table:has(th.select-all)', context).once('table-select', Drupal.tableSelect);

When the table is updated with #ajax, context is form and therefore, it doesn't find the table anymore.

Removing the form part fixes this.

CommentFileSizeAuthor
fix_tableselect_with_ajax.patch411 bytesBerdir
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Berdir’s picture

Oh, this is btw. another bug discovered by Privatemsg: #1021328: Using AJAX Actions breaks sorting of messages :)

rfay’s picture

subscribe

sun’s picture

Status: Needs review » Reviewed & tested by the community

Thanks!

To clarify:

When adding #ajax on a table or an element in a table, then the context that the AJAX framework creates is the form DOM element itself. Therefore, the selector

$('form table[...]', context)

cannot match the table, because form == context, so form cannot be found within context.

BenK’s picture

Since I was involved in reporting the original Privatemsg issue, I thought I'd chime in. The patch totally solves the problem for me. So I agree this is RTBC.

--Ben

dawehner’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
Dries’s picture

Status: Reviewed & tested by the community » Fixed

Committed to 8.x and 7.x. Thanks.

bfroehle’s picture

Issue tags: -Needs backport to D7

Untagging since it's been committed to 7.x

Status: Fixed » Closed (fixed)

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