FSN#40207 insert de row nu in de TBODY (op de juiste index)

svn path=/Website/trunk/; revision=33501
This commit is contained in:
2017-04-14 13:46:09 +00:00
parent 4df5a91659
commit 55705bd98b

View File

@@ -139,14 +139,26 @@ function largerWhenInIFrame()
FcltMgr.resized(window, { largerOnly: true });
}
function getIndexCorr(thisTable)
{
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;
}
}
return corr;
}
function hideInlineDetails(thisTR)
{
$(thisTR).find(".inlinedetails").toggleClass("closed");
$(thisTR).find(".inlinedetails").html("<i class='fa fa-fw fa-plus-square-o'>");
var thisTABLE = thisTR.parentNode;
if (thisTABLE.nodeName == "TBODY")
thisTABLE = thisTABLE.parentNode; // Indien de tabel een <tbody> heeft dan de parent <table> pakken.
thisTABLE.deleteRow(thisTR.rowIndex + 1); // De volgende rij verwijderen.
var thisTRParent = thisTR.parentNode; // TBODY of TABLE
var indexCorr = (thisTRParent.nodeName == "TBODY" ? getIndexCorr(thisTRParent.parentNode) : 0);
thisTRParent.deleteRow(thisTR.rowIndex + 1 - indexCorr); // De volgende rij verwijderen.
thisTR.inlineVisible = false;
return false;
}
@@ -167,10 +179,10 @@ function showInlineDetails(thisTD, strfnURL, position)
$(thisTR).find(".inlinedetails").toggleClass("closed");
$(thisTR).find(".inlinedetails").html("<i class='fa fa-fw fa-minus-square-o'>");
thisTR.inlineVisible = true;
var thisTABLE = thisTR.parentNode; // Parent node kan ook <tbody> zijn
if (thisTABLE.nodeName == "TBODY")
thisTABLE = thisTABLE.parentNode; // Indien de tabel een <tbody> heeft dan de parent <table> pakken.
var newRow = thisTABLE.insertRow(thisTR.rowIndex + 1); // De nieuwe rij erna toevoegen.
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 newRow = thisTRParent.insertRow(thisTR.rowIndex + 1 - indexCorr); // De nieuwe rij erna toevoegen.
newRow.id = thisTRid + "inline"
newRow.insertCell(0);
var theCell = newRow.insertCell(1);