When table option responsive is set, how to get parent('tr')?

When table option responsive is set, how to get parent('tr')?

bconnectvisionbconnectvision Posts: 3Questions: 2Answers: 0

According to the example - In table form controls, what if the table has responsive option set to true? The scripts to select table.row() will not be working as responsive created child row(s) for the columns out of width.

Any suggestions how to support the in table control?

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,489Questions: 1Answers: 10,470 Site admin
    Answer ✓

    This is the example should anyone else be reading this thread.

    The key is in what is passed to edit() as the first parameter. In the example it is $(this).closest('tr') since we know we want to edit the row that contains that element. In the case of Responsive we would need to check if the button is inside the responsive display or not before passing it on to Editor.

    For example you could use:

    var node = $(this).closest('li').length ?
      $(this).closest('li') :
      $(this).closest('tr');
    

    Then pass the node variable into edit(). This works because Responsive displays the hidden details in an li tag which can be used as a selector for the rows.

    Allan

This discussion has been closed.