moveRowWithKeyboard example

'id' => 3, 'weight' => 0, 'parent' => '', 'indentation' => 0, 'changed' => FALSE],
      ['id' => 4, 'weight' => 0, 'parent' => '', 'indentation' => 0, 'changed' => FALSE],
      ['id' => 5, 'weight' => 0, 'parent' => '', 'indentation' => 0, 'changed' => FALSE],
    ];
    if (!empty($drupal_path)) {
      $this->state->set('tabledrag_test_table', array_flip(range(1, 5)));
      $this->drupalGet($drupal_path);
    }
    $this->assertDraggableTable($expected_table);

    // Nest the row with id 2 as child of row 1.     $this->moveRowWithKeyboard($this->findRowById(2), 'right');
    $expected_table[1] = ['id' => 2, 'weight' => -10, 'parent' => 1, 'indentation' => 1, 'changed' => TRUE];
    $this->assertDraggableTable($expected_table);

    // Nest the row with id 3 as child of row 1.     $this->moveRowWithKeyboard($this->findRowById(3), 'right');
    $expected_table[2] = ['id' => 3, 'weight' => -9, 'parent' => 1, 'indentation' => 1, 'changed' => TRUE];
    $this->assertDraggableTable($expected_table);

    // Nest the row with id 3 as child of row 2.     $this->moveRowWithKeyboard($this->findRowById(3), 'right');
    $expected_table[2] = ['id' => 3, 'weight' => -10, 'parent' => 2, 'indentation' => 2, 'changed' => TRUE];
    
Home | Imprint | This part of the site doesn't use cookies.