Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

How to know the ID of selected row when i click the row

Hi

 

how to know the ID of clicked row in table view i am using iscroll.or how to know which row have hover.?i used this concept but does't work.

 

document.addEventListener('click', function (e) { e.preventDefault();

 

I share my code with you please help..

<!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 Schedule</title>
<!--<link href="style/style.css" rel="stylesheet" type="text/css" />-->
<link href="scrollbar.css" rel="stylesheet" type="text/css" />
<!--<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="iScroll.js"></script>
<style type="text/css">
.scroll-pane
{
width: 100%;
height: 150px;
z-index:1;
overflow: auto;
position: relative;

}

.scroll-pane table tr:hover
{
background:#dbe3ec;

}

table td {
	text-align: center;
}
</style>



<script type="text/javascript">


document.addEventListener('click', function (e) { e.preventDefault();

alert("a"); 
}, false);
function GetDepartureStationDashboard_callBack()
{
	//document.getElementById('loadingImg').style.visibility = "hidden";
	var tbl = document.getElementById('mainBodyDivContent');
	for (var i = 0; i < 20; i++) {
		var tr = document.createElement('tr');
		tr.setAttribute('id', i);
		
		var td1 = document.createElement('td');
		td1.setAttribute('width', '30%');
		td1.innerHTML = 'column 1.'+i;;
		
		var td2 = document.createElement('td');
		td2.setAttribute('width', '30%');
		td2.innerHTML = 'column 2.'+i;;
		
		var td3 = document.createElement('td');
		td3.setAttribute('width', '35%');
		td3.innerHTML = 'column 3.'+i;;
		
		var td4 = document.createElement('td');
		td4.setAttribute('width', '5%');
		td4.innerHTML = i;
		
		tr.appendChild(td1);
		tr.appendChild(td2);
		tr.appendChild(td3);
		tr.appendChild(td4);
		
		tbl.appendChild(tr);
	}
 var myScroll = new iScroll('mainBodyDiv', {snap: 'tr', scrollbarClass: 'myScrollbar' });
document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false);
	
}


</script>
</head>
<body onload="GetDepartureStationDashboard_callBack()">
<div id="wrapper">
<div class="login_cont">
<div class="home_icon"><a href="index.html"><img src="images/back-icon.png" alt="Home" title="Home" /></a></div>
<h1 class="fr">Departures</h1>
<div class="cl"></div>
<div class="mid_cont">
<div class="grid_cont">
<div class="heading_bar">
<h1 class="fl" id="headingcontent"></h1>
<input name="" type="button" class="heading_btn fr" value="Change" onclick="location.href='index.html'"/>
<div class="cl"></div>
</div>
<div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td width="30%">PLATFORM NO.</td><td width="30%">STD - ETD</td><td width="35%">NEXT STATION</td><td width="5%">STATUS</td>
	</tr>
</table>
</div>

<div class="scroll-pane" id="mainBodyDiv">
	<table width="100%" border="0" cellspacing="0" cellpadding="0" id="mainBodyDivContent">
		
	</table>
</div>

<div class="grid_error"><img src="images/help-icon.png" /> Departure Schedule</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="hdnStationName" id="hdnStationName" value="" />
</body>
</html>
 
 
Thanks

 

Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: How to know the ID of selected row when i click the row

Again double posted question that already got an answer here: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Get-click-event-of-row/m-p/18793...


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: How to know the ID of selected row when i click the row

sorry sir , i  was thinking that i am not able to understand to user, i will not do in future sorry

Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: How to know the ID of selected row when i click the row

I think what isn't really understandable in your post may be the long and unreadable source code. You do not need to put all the stuff. Try to add the neccessary parts to one or more code blocks. At the end it might helpful to have a running app from the devs around, but little bit of learning by doing, searching and reading sources around the web should be possible Smiley Wink


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.