get the checked prop of a hidden cell

get the checked prop of a hidden cell

IanEmeraldIanEmerald Posts: 2Questions: 1Answers: 0

Hi,

The Issue:

#

I have a checkbox in a cell with a known ID on each row.
For my code I need to check in a javascript function that we can 'select' it first.
I can then access the checked prop value and set it:
$('#' + CellID ).prop('checked', true);

However another function in use gives access to some selections that may not be visible.

$('#' + CellID ).prop('checked', true); 

will not work for them as they are not visible so setting the prop gets lost..

I've added two Options for the solution, as there may be a solution that works for one of them.
Thanks for you help with this.

Problem Option A:

#

Is there a way of setting the 'checked' prop for a hidden cell?

I.e. a straight forwards way of accessing the hidden checkbox prop value

Problem Option B:

#

I can access the cell - sort of. But as a raw data or as an object, not a checkbox.

I can get to the Cell raw data string using
table.cell('#td" +CellID ).data();

or the cell node using
table.cell('#td" +CellID ).node();

But how do I get access to the 'checked' property in either of those to be able to set it?

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @IanEmerald ,

    I just did this example for a different thread, but it's very similar problem to yours.

    To get the checked value, in your second example above, you can use:

    $(table.cell('#td" +CellID ).node()).find('input').prop('checked')
    
    
  • IanEmeraldIanEmerald Posts: 2Questions: 1Answers: 0

    Thanks that sorted it.
    Much appreciated.

    (apologies i hadn't hit upon the similar problem you answered when searching for an answer)

This discussion has been closed.