dont sort first row
dont sort first row
r3try
Posts: 11Questions: 0Answers: 0
Hi, i have a datatable where the first row is the insert-row (css-class=InsertRow)
I want to ignore that row when sorting the table so that the insert-row is always the first row.
edit:
following code seems to work despite the fact, that the first row moves either way...
when i debug the code the array gets constructed just like i want it to (insertrow is first entry) but the row is shown somewhere else either way.
[code]
jQuery.fn.dataTableExt.afnSortData['dom-text'] = function (oSettings, iColumn) {
var aData = [];
jQuery('td:eq(' + iColumn + ') input[type=text]:first', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
var col = jQuery(this).closest('tr');
if (col.hasClass('InsertRow')) {
aData.unshift("-1");//insert at front
} else {
aData.push(this.value);//append to back
}
});
return aData;
}[/code]
What am i doing wrong here?
Best regards,
r3try
I want to ignore that row when sorting the table so that the insert-row is always the first row.
edit:
following code seems to work despite the fact, that the first row moves either way...
when i debug the code the array gets constructed just like i want it to (insertrow is first entry) but the row is shown somewhere else either way.
[code]
jQuery.fn.dataTableExt.afnSortData['dom-text'] = function (oSettings, iColumn) {
var aData = [];
jQuery('td:eq(' + iColumn + ') input[type=text]:first', oSettings.oApi._fnGetTrNodes(oSettings)).each(function () {
var col = jQuery(this).closest('tr');
if (col.hasClass('InsertRow')) {
aData.unshift("-1");//insert at front
} else {
aData.push(this.value);//append to back
}
});
return aData;
}[/code]
What am i doing wrong here?
Best regards,
r3try
This discussion has been closed.
Replies
Im thankful for every clue on this issue....
best regards,
r3try
Allan
http://live.datatables.net/erupuf/2/edit
what can i do to fix the first row? (class of tr element is InsertRow)
Allan