Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
i need some help for my app ,in my app i get list of data from web service(example Name which have number of duplicate entry ).when application launch it show all name.
there is one text field in top where i write name (for getting information)so if i write ex naveen then it show all naveen from the list only.


Can you please help me.

Thanks
Posted

1 solution

Hi,

You need to crate one function that takes input as the list and search string. the function will return the filtered list from the javascript.

Hope it works for you.
 
Share this answer
 
v2
Comments
ravi1989h 17-Sep-12 2:13am    
Hi i show some demo but not able to do that ..onload i call one function insert data in table , i store the name in name array.on click i want to all name which have same name ..


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Departure dashboard</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
<link href="style/scrollbar.css" rel="stylesheet" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<script type="text/javascript" src="script/common.js"></script>
<script type="text/javascript" src="script/soapclient.js"></script>
<script type="text/javascript" src="script/jquery.min.js"></script>
<script type="text/javascript" src="script/iScroll.js"></script>
<!--script type="text/javascript" src="cordova-1.9.0.js"></script-->
<script type="text/javascript">
var stationCode;
var stationName;
var myTimedCall;
var myScroll;
var name=new Array();


function GetDepartureStationDashboard_callBack()
{

var tbl = document.getElementById('mainBodyDivContent');

for (var i = 0; i <20; i++) {
var tr = document.createElement('tr');
tr.setAttribute('id', i);
(function(id) {
tr. önclick = function() {
if(myScroll.isScrolling) {return;}


};
}(i));





var td1 = document.createElement('td');
td1.setAttribute('style','width:1%');
td1.setAttribute('align','left');


td1.innerHTML = i;


var td2 = document.createElement('td');
td2.setAttribute('style','width:47%; text-align;left;');


td2.innerHTML = "jh" + "-" + "gjhg";
var td3 = document.createElement('td');
td3.setAttribute('style','width:35%; text-align;left;');

if(i<5){
td3.innerHTML = "dfdd";
name[i]="dfdd";
}
else{
td3.innerHTML = "dsfdfsdf";
name[i]="dsfdfsdf";
}
var td4 = document.createElement('td');
td4.setAttribute('style','width:3%');
td4.setAttribute('align','center');




tr.appendChild(td1);
tr.appendChild(td2);
tr.appendChild(td3);
tr.appendChild(td4);

tbl.appendChild(tr);
}


myScroll = new iScroll('mainBodyDiv', {
snap: 'tr',
scrollbarClass: 'myScrollbar',
"onScrollMove": function(e) {
myScroll.isScrolling = true;
},
"onScrollEnd": function(e) {
window.setTimeout(function() {myScroll.isScrolling = false;}, 120);
}
});

}


function FillValues(){

// var result = name.Where(s=> name == "dfdd");
//alert(result[0]);
}


</script>
</head>
<body önload="GetDepartureStationDashboard_callBack()">
<div class="scroll-pane" id="mainBodyDiv">
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="mainBodyDivContent">
</table>

</div>
</div>
<button type="submit" id="submitBtn3" class="btn" önclick="FillValues();" >All today</button>
</body>
</html>
ravi1989h 17-Sep-12 2:13am    
can you please help
AmitGajjar 17-Sep-12 2:15am    
are you using javascript only ?
AmitGajjar 17-Sep-12 2:18am    
Don't post code dump here, Improve question to update your question.
ravi1989h 17-Sep-12 2:17am    
yes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900