Modifying cell properties in createdRow when hiding columns

Modifying cell properties in createdRow when hiding columns

billshbillsh Posts: 2Questions: 1Answers: 0

I'm a newbie and one common action I have with our tables is to modify cell properties such as changing strings to links, adding classes based on values, etc. I've had success with this using createdRow with something like:

if (parseFloat(data['change']) <= 0) {
      $('td', row).eq(5).addClass('negative');
}

I'm also playing with using the Buttons plugin to dynamically hide columns. That causes the relative references to break.

Is there a best practice for referencing a column in createdRow based on the data source vs the current view? Can the column be referenced by the data field name vs a position, etc?

I found this post which appears to be a very similar issue and I'm playing with suggestions made there.

I wasn't sure if there was a generally accepted way to accomplish this.

I'm using DT 1.10.12 and Buttons 1.2.2.

Thanks all!
Bill

Answers

  • billshbillsh Posts: 2Questions: 1Answers: 0

    A little more digging and I think I found something that appears to work using createdCell.

    Nice example here.

This discussion has been closed.