Datatables getting data from hidden columns

Datatables getting data from hidden columns

dkiltydkilty Posts: 3Questions: 1Answers: 0

Maybe I am doing something completely wrong: When trying to get using datatable.row(x),data(), I can retrieve data for both hidden and visible data when using a static table (i.e. the data is defined in the html at design time).

However, if I try the same call, when the data source is an API, all that is returned is the data for visible columns. Is this expected? Or is there a different way I need to access the hidden column data?

It seems like the data is in the plugin as using the filter still searches against the hidden columns

Answers

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    This example gets all the row data including hidden columns and data not defined as a column (Office for example).
    http://live.datatables.net/funijosu/1/edit

    Not sure why its not working for you. Please post a link to your page or a test case replicating the issue so we can help debug.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • dkiltydkilty Posts: 3Questions: 1Answers: 0

    Your live.datatables.net link seems to 404.

    I will try to post a example page when I can, might take a bit.
    Note: this is specifically when I use an external (api) data source. I am also using the render functionality on data load to do some transformations.

    If other people are able to retrieve hidden columns when using an external data source, then at least I know it's me or how I have something configured .

  • kthorngrenkthorngren Posts: 21,343Questions: 26Answers: 4,954

    Your live.datatables.net link seems to 404.

    I tried it and it works. Try a different browser or clearing your browsers cache.

    I am also using the render functionality on data load to do some transformations.

    Is it the columns using columns.render that your are asking about? In this case use cell().render() or cells().render() to get the rendered data.

    Kevin

  • dkiltydkilty Posts: 3Questions: 1Answers: 0

    I stand corrected this works perfectly fine, thanks everyone :).

    I was using a datatable wrapped in another library. The initialization via that library seemed to be the issue, though a very odd, specific result.

    Creating an example just using the datatables js pointed me in the right direction as it was functioning fine.

    Thanks!

Sign In or Register to comment.