Uncaught TypeError and other problems with simple tabledrag example

Created on 20 September 2024, 7 months ago

The simple tabledrag example has a few problems.

When the page is first displayed, the "Hide/Show row weights" button shows up as what I guess is an empty button. If you click on it, it changes to a normal "Show row weights" button and subsequently toggles normally between that and "Hide row weights".

In the browser console, there's a javascript error:

Uncaught TypeError: Cannot read properties of undefined (reading 'colSpan')
    at HTMLTableRowElement.<anonymous> (tabledrag.js?v=10.4.0-dev:371:21)
    at Function.each (jquery.min.js?v=3.7.1:2:3129)
    at ce.fn.init.each (jquery.min.js?v=3.7.1:2:1594)
    at tabledrag.js?v=10.4.0-dev:340:12
    at Array.forEach (<anonymous>)
    at Drupal.tableDrag.initColumns (tabledrag.js?v=10.4.0-dev:318:43)
    at new Drupal.tableDrag (tabledrag.js?v=10.4.0-dev:262:10)
    at initTableDrag (tabledrag.js?v=10.4.0-dev:42:36)
    at tabledrag.js?v=10.4.0-dev:50:9
    at Array.forEach (<anonymous>)

The drag handles and the weight fields are both displayed at first. Toggling between Show and Hide row weights make them appear correctly.

The drag handle never actually moves the row.

Submitting the form with 'Save Changes' results in a database error:

Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[22007]: Invalid datetime format: 1292 Truncated incorrect DOUBLE value: 'actions': UPDATE "tabledrag_example" SET "weight"=:db_update_placeholder_0, "description"=:db_update_placeholder_1 WHERE "id" = :db_condition_placeholder_0; Array ( [:db_update_placeholder_0] => [:db_update_placeholder_1] => [:db_condition_placeholder_0] => actions ) in Drupal\tabledrag_example\Form\TableDragExampleSimpleForm->submitForm() (line 176 of modules/contrib/examples/modules/tabledrag_example/src/Form/TableDragExampleSimpleForm.php).

The more complicated tabledrag examples seem to be fine.

πŸ› Bug report
Status

Active

Version

4.0

Component

Tabledrag Example

Created by

πŸ‡ΊπŸ‡ΈUnited States brad.bulger

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @brad.bulger
  • πŸ‡¬πŸ‡§United Kingdom oily Greater London

    @brad.bulger Can you please edit the issue to provide the core version(s) of Drupal on which someone do a local install of the examples module in order to reproduce this error. Thank you in advance.

Production build 0.71.5 2024