Programmatically toggling the inlineedit class for specific column

Programmatically toggling the inlineedit class for specific column

cj1005cj1005 Posts: 142Questions: 45Answers: 1

Hi,

I have a standalone checkbox (not within a datatable) that when clicked updates some backend data and then reloads the data via ajax on a datatable, but one of the columns (the 10th column) must only be inline editable when the aforementioned checkbox is unticked.

Currently, I'm handling this by refreshing the page after the checkbox has been clicked, but it is not very elegant or efficient.

So my question is, can I use javascript to toggle the 'inlineedit' class for a specific column when the checkbox is ticked or not?

Thanks, Chris

Answers

  • cj1005cj1005 Posts: 142Questions: 45Answers: 1

    I think I've found what I'm looking for:

    var cells = table.cells( null, 10 ).nodes();
    $( cells ).toggleClass( 'inlineEdit' );

  • allanallan Posts: 61,972Questions: 1Answers: 10,160 Site admin

    Looks good - nice one. Thanks for posting back.

    Allan

Sign In or Register to comment.