/    Sign up×
Community /Pin to ProfileBookmark

Row filter (IE javascript problem)

Hi all

Im doing some dynamic row filter in a table
The below code in ex 1 works just fine alltough its letter case sensitive
but soon as i read the same table data from a xml file “fill method(DSO)” se below ex.2
then it stops filtering ???

is there somebody wise who can see where i dropped the ball ! ?
__________________________________________________________-
EX.1
<html>
<head>
<title>Html Row Filter</title>
<script language=”JavaScript” >
var colKey_Name = 0;
var colKey_Group = 1;
var colKey_Salary = 2;
var colKey_Zone = 3;
var colKey_Status = 4;

function filterTab(theField,tabID,colKey){
var row = document.getElementById(tabID).rows;
for(var i=0;i<row.length;i++){
if(row[i].className==”dataRow”){
var cell=row[i].cells;
if(cell[colKey].innerHTML.indexOf(theField.value)<0){
row[i].style.display=”none”;
} else {
row[i].style.display=”block”;
}
}
}
}
</script>
</head>
<body>
<form ID=”Form1″>
<table id=”dataTable” cellspacing=”0″ cellpadding=”2″ border=”1″>
<tr class=”dataRow”>
<td width=”80″>Joe</td>
<td width=”100″>Alpha</td>
<td width=”100″>400 USD</td>
<td width=”180″>North,South</td>
<td width=”80″>Off-Site</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>Celest</td>
<td width=”100″>Beta</td>
<td width=”100″>50000 YEN</td>
<td width=”180″>North</td>
<td width=”80″>OK</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>Brian</td>
<td width=”100″>Alpha</td>
<td width=”100″>4000 SGD</td>
<td width=”180″>North,East,South</td>
<td width=”80″>Off-Site</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>David</td>
<td width=”100″>Alpha</td>
<td width=”100″>7000 SGD</td>
<td width=”180″>West,South</td>
<td width=”80″>On Leave</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>Pauline</td>
<td width=”100″>Gamma</td>
<td width=”100″>450 USD</td>
<td width=”180″>West</td>
<td width=”80″>On Leave</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>April</td>
<td width=”100″>Gamma</td>
<td width=”100″>2400 SGD</td>
<td width=”180″>North, West</td>
<td width=”80″>OK</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>Sharon</td>
<td width=”100″>Beta</td>
<td width=”100″>2000 SGD</td>
<td width=”180″>East,South</td>
<td width=”80″>Off-Site</td>
</tr>
<tr class=”dataRow”>
<td width=”80″>Paul</td>
<td width=”100″>Beta</td>
<td width=”100″>2500 SGD</td>
<td width=”180″>North,South,East,West</td>
<td width=”80″>On Leave</td>
</tr>
</table>
</form>
<input type=”text” name=”fltName” size=”20″ onKeyUp=”filterTab(this,’dataTable’,colKey_Name)” ID=”Text1″>
</body>

</html>
———————————————————————-

EX.2
___________________________________________________________
<XML SRC=”Source.xml” ID=”topic”></XML>

<table id=”dataTable” dataSrc=”#topic” cellpadding=”2″ border=”1″>
<tr class=”dataRow”>
<TD><SPAN dataFld=”Name”></SPAN></TD>
<TD><SPAN dataFld=”Group”></SPAN></TD>
<TD><SPAN dataFld=”Salary”></SPAN></TD>
<TD><SPAN dataFld=”Zone”></SPAN></TD>
<TD><SPAN dataFld=”Status”></SPAN></TD>
</tr>
</table>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @me2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.9,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...