[Please Help] Row Selection with Fixed column
[Please Help] Row Selection with Fixed column
hiren55
Posts: 6Questions: 0Answers: 0
Dear Allen,
I am using datatable with fixed column plug in.
but when i click row on fixed columns, it doesn't select entire row but only selects Fixed column row.
could you please provide solution like 1. clicking fixed columns in row will select entire row or 2. disabling row select on fixed columns.
I haven't put link to test case as this is easy to produce scenario and am not working on live website. hope you will help without test case.
Thank You.
I am using datatable with fixed column plug in.
but when i click row on fixed columns, it doesn't select entire row but only selects Fixed column row.
could you please provide solution like 1. clicking fixed columns in row will select entire row or 2. disabling row select on fixed columns.
I haven't put link to test case as this is easy to produce scenario and am not working on live website. hope you will help without test case.
Thank You.
This discussion has been closed.
Replies
I'll integrate events into it one day for selected rows, but it isn't in yet.
Allan
Thank You for quick reply.
I added fc.fnupdate on child (oTable) table row select event as below.
fc = new FixedColumns( oTable, {
"iLeftColumns": 3,
"sHeightMatch" : "auto",
"iLeftWidth": 350
} );
oTable.$('tr').click( function () {
aData = oTable.fnGetData(this); // get datarow
fc.fnUpdate();
});
1. when clicked oTable rows, it updates fixed column row but on wrong index. :(
2. when i click fixed colum row, it doen't select child table row.
Am i doing something wrong? m sorry but m little new to javascript and jquery usages.
Allan
unfortunatly i have no rights to share code link. i tried a lot fixing above case, but finally i have ended by droping usage of fixed column plug in. i removed it. in my project i am using almost 20 different datatables and all table has large no of rows which can not fit in single screen. so i wanted to fix main column.
anyways thank you very much for your all support and for such wonderfull datatables....
I added rowData class to HTML code so when the fixed columns is created it has that class.
Then I Identified the new created table with the class DTFC_Cloned as selector
Hope it helps
$(".rowData").live("click", function () {
var row = $(this);
$("#grdTests tr.rowData").removeClass("rowData-selected");
$(".DTFC_Cloned tr.rowData").removeClass("rowData-selected");
var rowIndex = row.index() + 1;
if (row.parent().parent().hasClass("DTFC_Cloned")) {
$("#grdTests tr.rowData:nth-child(" + rowIndex + ")").addClass("rowData-selected");;
} else {
$(".DTFC_Cloned tr.rowData:nth-child(" + rowIndex + ")").addClass("rowData-selected");
}
row.addClass("rowData-selected");
});
@dacanetdev
Thank you very much! Works for me.
Its worth pointing out that
$().live()
has been removed from the newer versions of jQuery. They recommend using$().on()
now: docs.Allan