Selecting a row based on a cell value

Selecting a row based on a cell value

lucschulzlucschulz Posts: 2Questions: 1Answers: 0

I can't seem to find an example anywhere on how to select a row based on a cell value in it.

Example: If a row has a specific GUID under the field name "ID", how do I get a reference to that row using the GUID?

This question has an accepted answers - jump to answer

Answers

  • lucschulzlucschulz Posts: 2Questions: 1Answers: 0

    Figured it out.

    var table = $(this.jQueryTableId).DataTable(); var row = table.row({contains: guid}).data(); console.log(row);

  • kthorngrenkthorngren Posts: 20,276Questions: 26Answers: 4,765

    table.row({contains: guid}).data();

    I don't believe there is an option contains. Test it to make sure but I think this will always result in the first row. I think you will want to use row-selector as a function. The docs have an example.

    Kevin

  • colincolin Posts: 15,142Questions: 1Answers: 2,586
    Answer ✓

    It's close - the correct format is

      table.row(':contains("Ashton")').select()
    
    

    See here: http://live.datatables.net/gaboqoxo/1/edit

    Colin

This discussion has been closed.