var SelectedRowsCount = new Array();
var AllRowsCount = new Array();
var HeaderCheckBox = new Array();
function CountCheckedRowsByCol(detailTableName, colNum)
{
AllRowsCount[colNum] = 0;
SelectedRowsCount[colNum] = 0;
var detailTable = document.getElementById(detailTableName);
if (detailTable == null)
return;
var Rows = detailTable.getElementsByTagName("tr");
if (colNum == null)
colNum = 0;
for (i = 0; i < Rows.length; i++)
{
var cols = Rows[i].getElementsByTagName("td");
if (cols.length <= colNum)
continue;
var chks = cols[colNum].getElementsByTagName("input");
if (chks.length == 0)
continue;
if (chks[0].type != "checkbox")
continue;
if (AllRowsCount[colNum] == 0)
{
if (HeaderCheckBox[colNum] == null)
HeaderCheckBox[colNum] = chks[0];
}
else
{
if (chks[0].checked)
SelectedRowsCount[colNum]++;
}
AllRowsCount[colNum]++;
}
AllRowsCount[colNum]--;
// alert(AllRowsCount[colNum]);
//CheckHeaderIfAllColChkBoxSelected(colNum);
}
var AllRowsCount = new Array();
var HeaderCheckBox = new Array();
function CountCheckedRowsByCol(detailTableName, colNum)
{
AllRowsCount[colNum] = 0;
SelectedRowsCount[colNum] = 0;
var detailTable = document.getElementById(detailTableName);
if (detailTable == null)
return;
var Rows = detailTable.getElementsByTagName("tr");
if (colNum == null)
colNum = 0;
for (i = 0; i < Rows.length; i++)
{
var cols = Rows[i].getElementsByTagName("td");
if (cols.length <= colNum)
continue;
var chks = cols[colNum].getElementsByTagName("input");
if (chks.length == 0)
continue;
if (chks[0].type != "checkbox")
continue;
if (AllRowsCount[colNum] == 0)
{
if (HeaderCheckBox[colNum] == null)
HeaderCheckBox[colNum] = chks[0];
}
else
{
if (chks[0].checked)
SelectedRowsCount[colNum]++;
}
AllRowsCount[colNum]++;
}
AllRowsCount[colNum]--;
// alert(AllRowsCount[colNum]);
//CheckHeaderIfAllColChkBoxSelected(colNum);
}
No comments:
Post a Comment