Datatable FixedColumns row selection

Datatable FixedColumns row selection

segnini75segnini75 Posts: 6Questions: 0Answers: 0
edited December 2011 in Plug-ins
Im trying to do a row selection using the fixed column plugin but I can't manage to get that.

In principle, as the object that returns FixedColumns() doesn't have .fnSettings().aoData i cant access to the properties that control the styles (in all the table model not only in visible layer).

With normal dataTables i'm doing it simply doing in that way:

[code]
$('.dataTable tbody').click(function(event) {
$(tablas[tab].fnSettings().aoData).each(function (){
$(this.nTr).removeClass('row_selected');
$(this.nTr).find("input[type=radio]").removeAttr("checked");
});
$(event.target.parentNode).addClass('row_selected');
});
[/code]

That doesnt work with fixedColumns!.

Then im trying to access to the old datatable model generated before the FixedColumns() call but I can only access to the right part of the table (yes, these with the scroll wrapper).

Any help please?

Thanks a lot

Replies

  • fbasfbas Posts: 1,094Questions: 4Answers: 0
    Don't you have a reference to the DataTable object?

    [code]
    /*
    * Example initialisation
    */
    $(document).ready( function () {
    var oTable = $('#example').dataTable( {
    "sScrollY": "300px",
    "sScrollX": "100%",
    "sScrollXInner": "150%",
    "bScrollCollapse": true,
    "bPaginate": false
    } );
    new FixedColumns( oTable );
    } );[/code]

    you can still use oTable.fnSettings();

    the FixedColumns object won't be a DataTable, but you still have a DataTable object.
  • segnini75segnini75 Posts: 6Questions: 0Answers: 0
    edited December 2011
    Yes I have it (tablas[tab] ) but selections doesn't work with that reference object.

    the code works fine with dataTable without fixed columns but after inicialization of FixedColumns().
  • segnini75segnini75 Posts: 6Questions: 0Answers: 0
    edited December 2011
    Another thing about this topic is the fact that when i try to do this (see code) the aPos variable have a problem, if i click on the "Scroll" part of the table works ok returning the node i have to work (for the right part). but when i click on left side of the table (fixed columns) aPos its NULL then i cant access to teh other side of the model. Please givme a hand with that! thanks a lot.

    [code]
    alert("evt:"+event.target);
    aPos = tablas[tab].fnGetPosition(event.target.parentNode);
    alert("Posicion: "+aPos);
    [/code]
  • segnini75segnini75 Posts: 6Questions: 0Answers: 0
    I was able to select the entire row aplying a new style using attr("class","row_selected"); but only works on the "Scroll" part of the table. If i click on the left side it doesnt do anithing. Aditionally i have to call fnDraw(false). I have to find a method to access to the oTable object via the onClick over the "fixed" part of the table.
This discussion has been closed.