addressing FixedColumns columns

addressing FixedColumns columns

veloopityveloopity Posts: 39Questions: 14Answers: 2

I have no test case to show but maybe my question can be answered without one.

My DataTables table can be set to have the leftmost three columns as FixedColumns. On top of the complexity that this creates, the first column contains an ID number but appears as a checkbox (it gets rendered into a checkbox by aoColumnDefs and mRender).
Without the FixedColumns in place, the checkboxes can be used (I gather their values into a textarea before sending the form that contains the DataTable), but when FixedColumns is in place, the checkboxes appear as undefined for the javascript that copies their values - I assume because FixedColumns creates a separate table.
How would I address the checkboxes that are part of this separate table?

Answers

  • colincolin Posts: 9,165Questions: 0Answers: 1,532

    Hi @veloopity ,

    This example here should help - this is for a header element, but the same would apply for the table body.

    Cheers,

    Colin

  • veloopityveloopity Posts: 39Questions: 14Answers: 2

    thx Colin! I'm sure the example should help anyone with enough jQuery experience but unfortunately I don't know how to retrieve all field names and (in my case) checkbox checked status of all cells in the first column.

    Anyone?

  • colincolin Posts: 9,165Questions: 0Answers: 1,532

    If you can modify that example to show your checkboxes, or create your own test case, we'd be happy to take a look.

  • veloopityveloopity Posts: 39Questions: 14Answers: 2

    thanks Colin. Here's a quick and pretty ugly test case:

    http://mpeters.de/temp/datatables_fixedcolumns.htm

    The two first columns are fixed. The first column has a checkbox. On button click, a list of all checkboxes should be displayed (their contents are 111,222, etc) along with their "checked" status.

    Please let me know if I should add any functionality.

    -Michael

  • colincolin Posts: 9,165Questions: 0Answers: 1,532

    Hi @veloopity ,

    This here is showing how you can count the checkboxes, using your example but in the DataTables live environment.

    Hope that helps,

    Cheers,

    Colin

  • veloopityveloopity Posts: 39Questions: 14Answers: 2

    thx very much Colin, retrieving the checkboxes works this way.

    I hope I don't ask for too much (as I wrote I'm not a jQuery programmer) but I also need to set these checkboxes, not just read or count them. In my project, <th> contains a header checkbox - clicking it checks all first column checkboxes, or unchecks them all, depending on a global 'Allchecked' variable that I initialize as 'false'. Works well if no columns are fixed. I need this also for the fixed columns version but no matter what I've tried, I can't figure out how to do this using your code.

  • colincolin Posts: 9,165Questions: 0Answers: 1,532

    Hi @veloopity ,

    That's a simple cut&paste of the counting function - see here.

    Cheers,

    Colin

  • veloopityveloopity Posts: 39Questions: 14Answers: 2

    cheers & thanks bunches, will try that

Sign In or Register to comment.