Dynamically change the height of "sScrollY"

Dynamically change the height of "sScrollY"

dajones12dajones12 Posts: 5Questions: 3Answers: 0

Hello,
I'm a complete beginner here, so I apologize if this is a simple question. How do I go about making the height of my table dynamic based on the rows in it? My current code is:

$(document).ready(function() {
                var oTable = $('#displayTable').dataTable( {
                    "bPaginate": true,
                    "processing": true,
                    "bDeferRender": true, 
                    "bAutoWidth": true,
                    "sScrollY": "300px",
                    "bStateSave": true,
                    "sDom": '< TC > ftiS',
                    "oTableTools": {
                        "sSwfPath": "js/copy_csv_xls.swf",
                        "aButtons": [
                            "copy",
                            "print",
                            {
                                "sExtends":    "collection",
                                "sButtonText": "Save",
                                "aButtons":    [ "xls" ]
                            }
                        ]
                    },

Ideally, I would like for it to have a max height of 300px, but be shorter if there are fewer rows.

Thanks!

This question has an accepted answers - jump to answer

Answers

This discussion has been closed.