Refer a cell by name

Refer a cell by name

uskerineuskerine Posts: 33Questions: 15Answers: 0
edited August 2014 in Free community support

Hi, in a table which includes the following definition:

"columnDefs": [
...
{
  "name": "price",
  "targets": [ 4 ],
  "data": "price",
  "render": function(data) { 
    return (data); 
},
...

A cell is being currently refered by using:

oTable.cell(row,4).data();

Is there anyway to use its name ("price") instead of its position index (4)?

Thanks,

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 63,516Questions: 1Answers: 10,472 Site admin
    Answer ✓

    Yes, the column-selector can be used to reference columns by name. In this case you would use:

    oTable.cell( row, 'price:name' ).data();
    

    Allan

  • uskerineuskerine Posts: 33Questions: 15Answers: 0

    Thanks, that helps a lot to mantain code readable

This discussion has been closed.