NOT WORKING: Using a generated content (button) in a column that's also fixed

NOT WORKING: Using a generated content (button) in a column that's also fixed

RobertMauroRobertMauro Posts: 4Questions: 1Answers: 0
edited April 2020 in Free community support

I'm using the code at this link to generate buttons controlling jQuery code. That works wonderful, until I fix the column in place. Once I do that, the button does not fire.

Any suggestions? Is there a subtable I should be calling for the button?

This is where the fixed column code comes from.
https://datatables.net/extensions/fixedcolumns/examples/initialisation/left_right_columns.html

Thanks in advance.

This question has an accepted answers - jump to answer

Answers

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

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • RobertMauroRobertMauro Posts: 4Questions: 1Answers: 0
    edited April 2020

    Hi Colin, I will build a test case, since it's an internal site that I cannot publish, but, I have literally used the exact code used in the examples I cited (hence I didn't build a test case).

    Either example works independently. Making the column with the button fixed makes the button not fire.

    In the past, issues like this were caused by the separate table being built for fixed columns. But it was ages ago and many releases ago that we figured that out.

    Test case soon.

  • RobertMauroRobertMauro Posts: 4Questions: 1Answers: 0
    edited April 2020

    Hi Colin, Everyone:

    Output pane must be detached into a new window for alert to work (I'm not really using alert in anything but my test code).

    http://live.datatables.net/larihico/1/

    Uncomment fixedColumns in the Javascript, and the first column will lock itself in place as intended. But, now the button does not fire any event.

    Or check this version which has fixedColumns uncommented. Nothing else is different in the project.
    http://live.datatables.net/ceviqijo/1/

    Thanks all!

  • kthorngrenkthorngren Posts: 21,171Questions: 26Answers: 4,922
    Answer ✓

    FixedColumns clones the fixed columns into a new table which doesn't have the original table's ID. You can inspect the table to see this and to see options for selectors you can use. I changed it to use $('.dataTable tbody').on( 'click',..... For example:
    http://live.datatables.net/jicefasa/1/edit

    It uses console.log instead of alerts and works whether you have fixedColumns enabled or not.

    Kevin

  • RobertMauroRobertMauro Posts: 4Questions: 1Answers: 0
    edited April 2020

    Thanks Kevin, and you took into account that the data is in the parent table. Thanks for that too.

    Best,
    Rob

This discussion has been closed.