Unable to addClass on Aldeed:Tabular

Hi,

I’m unable to add a class to a table row using this solution. When I inspect on the browser, I always see the row class as either “odd” or “even”. Here’s my code:

TabularTables = {};

TabularTables.Logins = new Tabular.Table({
///rows skipped
createdRow: function(row, data, dataIndex) {
    if(data[1]=="Y"){
    row.addClass('loggedincolor');
	}
},

Any obvious reason this wouldn’t work? Thanks.

Change the above to:

$(row).addClass('loggedincolor');

Thanks @hwillson, this works, however, I tested that my if statement

    if(data[1]="Y"){...} 

Always returns false. I am trying to check if the 2nd column of my table has data=“Y”. Is that the correct syntax? I’m taking the syntax from here.

That syntax looks okay (your code sample is missing a “=” but your original sample has it, so I’m assuming that’s just a copy/paste error). Maybe try dumping the contents of your data array first, to make sure it contains the values you think it should:

createdRow: function(row, data, dataIndex) {
  console.log(data);
  ...
},

Brilliant, thanks @hwillson. Using that, I found out my 2nd column doesn’t come from MongoDB but derived from a function. I had to alter it to this:

createdRow: function(row, data, dataIndex) {
    if(data['RegisteredAt']!="N/A"){
        $(row).addClass('loggedincolor');
	}
}, 

Thanks!!