DataTables logo DataTables

wjshohs: fnShowHide
  • Originally from wjshohs, following on from http://datatables.net/forums/comments.php?DiscussionID=2815:

    I also found the bug with fnShowHide function

    You could see the same page, and when JS starts this function i have
    an error:Node was not found" code: "8
    [Break on this error] j(">td:eq("+i+")",c.aoData[d].nTr)[0])...unction(){var a=B(this[m.iApiIndex]),

    And I know why it happens. 'because of in <thead> first <tr> before the columns listing <tr> i have

    <tr>
    <td colspan="2" class="grey nav">
    <a href="#"><img src="<?= $this->urls->images ?>nav_icons/first.gif" alt="" width="6" height="9" /></a>
    <a href="#"><img src="<?= $this->urls->images ?>nav_icons/prev.gif" alt="" width="5" height="9" /></a>
    <input name="" type="text" class="num" value="1" />
    of 15
    <a href="#"><img src="<?= $this->urls->images ?>nav_icons/next.gif" alt="" width="5" height="9" /></a>
    <a href="#"><img src="<?= $this->urls->images ?>nav_icons/last.gif" alt="" width="6" height="9" /></a>
    </td>

    <td colspan="31"> </td>
    </tr>

    if I move it in thead after the tr with th list - all is ok. But i need it before the columns list because of design. Could I handle with it?

    I found that I could try to use new table before the datatable table, but to have a connection with datatable columns in sense of using colspan I need constantly get ColumnsWidth from there and set it to the columns of upper table. but all actions are into datatables library. and to do it I need to hack your lib which is not good with the context of using the updates
  • I'm slightly lost - what is the fnShowHide function? It's not in DataTables, nor FixedColumns or ColVis.

    However, I can say that the problem, as you rightly point out, is likely the colspan. This post covers the visibility toggling of columns with colspan: http://datatables.net/forums/comments.php?DiscussionID=2897&page=1#Item_2

    Allan
  • fnSetColumnVis func, sorry. Yes i see in those topic that is unsolvable issue. I solved it in the way I'm using the another table before the datatables table. But how could I get the width of 2 first columns in the datatables table? Also could I setup every column width manual, not in automatic way like it is now?
  • For manual width you can set bAutoWidth: false - but bare in mind that there are a lot of factors which effect the column width - CSS for the overall table, content etc, which is why it's difficult to set an exact size on the columns.

    To get the column width, you can just use a bit of jQuery $('#example thead th:eq(0)).width().

    Allan
  • bAutoWidth: false - is not working, because after i setting into template

    <thead>
    <tr>
    <th width="13"> </th>

    after the page loaded , I make inspect element by firebug and have:
    <th width="13" class="sorting_desc" style="width: 20px;"> </th>

    so script adds style="width: 20px;". So could it possible to handle with it?
    All this things with the horizantol scrolling


    And the other question i want to ask U - how could I run any function AFTER anyone of datatables actions ran?
    Do you have some calls like afterDatatablesEvents?
    For example - i'm using some checkbox jquery plugin. After the data loads to the table with the new checkboxes element - every time i need to load checkbox initialization function. Is there some ability to do it?
    Anyway such ability would be great! If you have no such after actions for your events - would be great to add this.

    With all due respect
  • As I noted the column widths are difficult, and this is what you are seeing. There will be something which is forcing the column width to be 20px (the content perhaps?), and therefore with scrolling DataTables will fix the width at that size, so the header, footer and body all line up. That is read from the width that is rendered by the table. Perhaps try disabling DataTables and looking at the computed DOM to see what the cell's size is.

    For your other question: http://datatables.net/usage/callbacks#fnDrawCallback

    Allan
  • 1)fnSetColumnVis. How could I set it without asking to sAjaxSource? because if i need to change this param for several columns - i need to wait when sAjaxSource reloads several times with the same data.

    Is it possible to not use request to sAjaxSource when I'm using fnSetColumn? because of every time I'm reloading the same data.

    2) Also why after hiding some columns - i still have the old ScrollXInner width and columns which are still unhided get bigger width that they had before? is it possible to stay them with old width and to make scroll area smaller? you could see it on my page if you will use "select columns" button
  • 2 allan
    Also when I setup for all columns fixed width with pixels and doing hiding\unhiding columns with scrolling than if i use setuped sScrollXInner param - than columns that left - they makes wider and the scroll inner area stay with the same width. And if i'm not using sScrollXInner - then I have no actual widths for columns which I setuped before in <th width>
    and if bAutoWidth is true than scroll inner area comes smaller - but it is working only if sScrollXInner is not setuped. but without it setuped - columns have wrong width
This discussion has been closed.
All Discussions