Get row then first cell when using .cells().every() and current cell's data-attribute

Get row then first cell when using .cells().every() and current cell's data-attribute

punkilopunkilo Posts: 1Questions: 1Answers: 0

I have this :-

Name Grown Space
Sugar 100 Kg 100 sq.m
Oil 10 Lt 21 sq.m

Now I want is when I loop through the Grown column, i need to get name of the item (e.g. Sugar), data-value (100)

fancy_data_table.cells(".q").every( function () {

        var data=this.data(); //this is data of the cell.


    }); 

I am stuck here and the documetation didnt help me.

Answers

  • allanallan Posts: 63,471Questions: 1Answers: 10,467 Site admin
    var fancy_data_table.row( this.index().row ).data();
    

    will get the data for the whole row.

    It might be easiest if you use rows().every() though?

    Allan

This discussion has been closed.