FSN#40207 getCorrIndex werkt nu ook met voorgaande tbodies

svn path=/Website/trunk/; revision=33551
This commit is contained in:
2017-04-20 08:38:10 +00:00
parent 5b190399b1
commit a2c653e1a7

View File

@@ -139,16 +139,15 @@ function largerWhenInIFrame()
FcltMgr.resized(window, { largerOnly: true });
}
function getIndexCorr(thisTable)
function getIndexCorr(thisTbody)
{
var corr = 0;
var tHead = $("#" + thisTable.id).children('thead');
if (tHead.length) // if we want to insertrow on a TBODY we need to correct the rowindex by subtracting the amount of rows in the thead.
{
for (var i = 0; i < tHead.length; i++) { // multiple theads are possible
corr += tHead[i].rows.length;
}
}
$(thisTbody).prevAll('thead', 'tbody').each(function() { // tfoot is indexed after the tbody
// If we want to insertrow on a TBODY we need to correct the rowindex
// by subtracting the amount of rows in the previous tbodies & thead's.
if ($(this).length)
corr += $(this).length;
});
return corr;
}
@@ -157,7 +156,7 @@ function hideInlineDetails(thisTR)
$(thisTR).find(".inlinedetails").toggleClass("closed");
$(thisTR).find(".inlinedetails").html("<i class='fa fa-fw fa-plus-square-o'>");
var thisTRParent = thisTR.parentNode; // TBODY of TABLE
var indexCorr = (thisTRParent.nodeName == "TBODY" ? getIndexCorr(thisTRParent.parentNode) : 0);
var indexCorr = (thisTRParent.nodeName == "TBODY" ? getIndexCorr(thisTRParent) : 0);
thisTRParent.deleteRow(thisTR.rowIndex + 1 - indexCorr); // De volgende rij verwijderen.
thisTR.inlineVisible = false;
return false;
@@ -181,7 +180,7 @@ function showInlineDetails(thisTD, strfnURL, position)
thisTR.inlineVisible = true;
var thisTRParent = thisTR.parentNode; // Parent node kan ook <tbody> zijn
// Indien de tabel een <tbody> heeft dan de parent <table> pakken.
var indexCorr = (thisTRParent.nodeName == "TBODY" ? getIndexCorr(thisTRParent.parentNode) : 0);
var indexCorr = (thisTRParent.nodeName == "TBODY" ? getIndexCorr(thisTRParent) : 0);
var newRow = thisTRParent.insertRow(thisTR.rowIndex + 1 - indexCorr); // De nieuwe rij erna toevoegen.
newRow.id = thisTRid + "inline"
newRow.insertCell(0);