jQuery UI Widgets Forums DataTable Can't get the height of a datatable

This topic contains 3 replies, has 2 voices, and was last updated by  Peter Stoev 10 years, 10 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • Can't get the height of a datatable #48530

    antonomase
    Participant

    Hi,
    I have a datatable with 5 rows containing several lines. I do not fix the height of the datatable to avoid the vertical scrollbar.

    If I attenmpt to read $(“#jqxdatatable”).jqxDataTable(‘height’)), I get “undefined”.

    How can I get the real height of the datatable ?

    Best regards

    Can't get the height of a datatable #48534

    Peter Stoev
    Keymaster

    Hi antonomase,

    The default value of the DataTable’s “height” property is null which means that the result that you get is expected. If you set the DataTable’s height, it will return the correct property value. Example: http://jsfiddle.net/jqwidgets/4gq8H/. In addition, to get the height of any HTML Element, you can also use var height = $(“#dataTable”).height();

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    Can't get the height of a datatable #48538

    antonomase
    Participant

    Hi Peter,

    I have a Datatable with no height predefined. So the datatable adjust his height in fonction of his contents.
    What I try to do is to know if the datatable has a small height if the text in it is short or if the height has a large value if the text is very long.

    If my datatable is named “jqxdatatable”, i’ve seen in the code that the datas are in a table with id tablejqxdatatable and the header in a div columntablejqxdatatable.
    I can read and use the heights of this table and this div, but it is not “clean” (if on day you change the names of these elements).

    So for the moment, I have a window in a docking page and i do

     ready: function() {
      $('#mywindow').height($("#tablejqxdatatable").height() + $("#columnjqxdatatable").height()+40);
     },
    
    Can't get the height of a datatable #48555

    Peter Stoev
    Keymaster

    Hi antonomase,

    The dataTable’s height, if it is not set can be retrieved by using $(“#table”).height(). It is not necessary to perform custom calculation of the heights of inner elements. All IDs used in the widget are set dynamic and depend on the widget’s ID. If your widget’s ID is myTable then you will have an element with ID tablemyTable.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.