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

Show web service data in 9700 using phone gap technology

Hi. i want to show web service data in list but i face scrolling problem but i found this .  this remove my scolling problem.but in real i have array (response of webservice ) .i want to show this array .but cannot able to show please help.

 

 

Thanks

 

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="initial-scale=1.0,user-scalable=no" />
<link href="style/style.css" rel="stylesheet" type="text/css" />
<link href="style/scrollpanel.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">

function scroll(){

var elm = document.getElementById("mainBodyDiv");
// alert(elm);
var lastFocusId = parseInt(blackberry.focus.getFocus());
// alert(lastFocusId);

switch(blackberry.focus.getDirection()){
case 2 : // up
if(lastFocusId < 1 && lastFocusId > 9) //lastFocusId less than first element and greater than last element
blackberry.focus.setFocus((lastFocusId-1)+"");
elm.scrollTop -= 50; //height of single <li> element
break;
case 3 : // down
if(lastFocusId > 0 && lastFocusId < 9)
blackberry.focus.setFocus((lastFocusId+1)+"");
elm.scrollTop += 50;
break;
}
}

</script>

</head>
<body>
<div class="scroll-pane" id="mainBodyDiv">
<ul x-blackberry-focusable="true">
<li x-blackberry-focusable="true" id="1" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> a</li>
<li x-blackberry-focusable="true" id="2" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> b</li>
<li x-blackberry-focusable="true" id="3" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> c</li>
<li x-blackberry-focusable="true" id="4" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="5" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="6" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> e</li>
<li x-blackberry-focusable="true" id="7" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> f</li>
<li x-blackberry-focusable="true" id="8" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
<li x-blackberry-focusable="true" id="9" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>

 


<li x-blackberry-focusable="true" id="11" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> a</li>
<li x-blackberry-focusable="true" id="12" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> b</li>
<li x-blackberry-focusable="true" id="13" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> c</li>
<li x-blackberry-focusable="true" id="14" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="15" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="16" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> e</li>
<li x-blackberry-focusable="true" id="17" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> f</li>
<li x-blackberry-focusable="true" id="18" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
<li x-blackberry-focusable="true" id="19" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
</ul>

<form>
<input type="checkbox" name="vehicle" value="Bike" /> I have a bike<br />
<input type="checkbox" name="vehicle" value="Car" /> I have a car
</form>
</div>
</body>
</html>

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

Re: Show web service data in 9700 using phone gap technology


ravi1989 wrote:

Hi. i want to show web service data in list but i face scrolling problem but i found this .  this remove my scolling problem.but in real i have array (response of webservice ) .i want to show this array .but cannot able to show please help.

 

 

Thanks


How is your array data your service is delivering looking like and what you want to do with it? Can you provide little bit more informations?


"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: Show web service data in 9700 using phone gap technology

Hi sir thank for reply. actually i used soap type xml , in which i return array of objects from this object i call function to retrieve data .. i want to show this data in list . recently i am facing scrolling issue in 9700 . but when i put this code scrolling issue will be solved.but this time i want to show array .i will show some code




<!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="style/scrollpanel.css" rel="stylesheet" type="text/css" />
&lt;script type="text/javascript" src="script/soapclient.js">&lt;/script&gt;
&lt;script type="text/javascript" src="script/jquery.min.js">&lt;/script&gt;
&lt;script type="text/javascript" src="script/jquery.jscrollpane.min.js">&lt;/script&gt;


&lt;script type="text/javascript">
var url = "http://50.57.145.165:808/FirstGroupRailApps/services/RailAppsCAWS";



function scroll(){

var elm = document.getElementById("mainBodyDiv");
// alert(elm);
var lastFocusId = parseInt(blackberry.focus.getFocus());
// alert(lastFocusId);

switch(blackberry.focus.getDirection()){
case 2 : // up
if(lastFocusId < 1 && lastFocusId > 9) //lastFocusId less than first element and greater than last element
blackberry.focus.setFocus((lastFocusId-1)+"");
elm.scrollTop -= 50; //height of single <li> element
break;
case 3 : // down
if(lastFocusId > 0 && lastFocusId < 9)
blackberry.focus.setFocus((lastFocusId+1)+"");
elm.scrollTop += 50;
break;
}
}

function getParams()
{
var idx = document.URL.indexOf('?');
var params = new Array();
if (idx != -1)
{
var pairs = document.URL.substring(idx+1, document.URL.length).split('&');
for (var i=0; i < pairs.length; i++)
{
nameVal = pairs[i].split('=');
params[nameVal[0]] = nameVal[1];
}
}
return params;
}

function GetArrivalDashboard()
{

var pl = new SOAPClientParameters();
var params = getParams();
var parameter1 = unescape(params["getStationCode"]);
document.getElementById("headingcontent").innerHTML = "Station Code: " + parameter1;
pl.add("parameter1", parameter1);
SOAPClient.invoke(url, "getArrivalStationDashboard", pl, true, GetArrivalStationDashboard_callBack);
}
function GetArrivalStationDashboard_callBack(r)
{


*****************************here i want to show data r is array of object******************************
var tabledata = "";
tabledata += "<table x-blackberry-focusable="true">";
for (var i = 0; i < 4; i++)
{
tabledata += "<tr>";
tabledata += "<td width=\"30%\">" x-blackberry-focusable="true" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()" + i+ "</td>";

tabledata += "</tr>";
}
tabledata += "</table>";
document.getElementById("tableSpace").innerHTML = tabledata;
}
&lt;/script&gt;
</head>
<body onload="GetArrivalDashboard()">
<div id="wrapper">
<div class="login_cont">
<div class="home_icon"><a href="login.html"><img src="images/back-icon.png" alt="Home" title="Home" /></a></div>
<h1 class="fr">Arrivals</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='login.html'"/>
<div class="cl"></div>
</div>
<div class="scroll-pane" id:"mainBodyDiv">
<p id="tableSpace">

</p>
</div>
<div class="grid_error"><img src="images/help-icon.png" /> Arrival Schedule</div>
</div>
</div>
</div>
</div>
<input type="hidden" name="hdnStationName" id="hdnStationName" value="" />
</body>
</html>
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Show web service data in 9700 using phone gap technology

i am not understand what i write in this function GetArrivalStationDashboard_callBack(r) so that it will scroll data in fixed area .and so i am not able to use this code.



<li x-blackberry-focusable="true" id="11" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> a</li>
<li x-blackberry-focusable="true" id="12" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> b</li>
<li x-blackberry-focusable="true" id="13" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> c</li>
<li x-blackberry-focusable="true" id="14" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="15" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="16" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> e</li>
<li x-blackberry-focusable="true" id="17" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> f</li>
<li x-blackberry-focusable="true" id="18" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
<li x-blackberry-focusable="true" id="19" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Show web service data in 9700 using phone gap technology


ravi1989 wrote:
i am not understand what i write in this function GetArrivalStationDashboard_callBack(r) so that it will scroll data in fixed area .and so i am not able to use this code.



<li x-blackberry-focusable="true" id="11" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> a</li>
<li x-blackberry-focusable="true" id="12" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> b</li>
<li x-blackberry-focusable="true" id="13" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> c</li>
<li x-blackberry-focusable="true" id="14" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="15" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> d</li>
<li x-blackberry-focusable="true" id="16" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> e</li>
<li x-blackberry-focusable="true" id="17" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> f</li>
<li x-blackberry-focusable="true" id="18" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>
<li x-blackberry-focusable="true" id="19" x-blackberry-onUp="scroll()" x-blackberry-onDown="scroll()"> g</li>

Hi. The only information for me interesting at this time is, what the Soap service is responding. Since Soap uses XML it will be something packaged in XML, but how it looks like is the only thing I would need to go on to help you. All the other stuff you presented in the first post, if this is what it makes scrollable can be reused to manage it later than, but the structure of the XML data you get from the service is essential to help you more.


"Like" if you liked the post.
"Accept as Solution" if the post solves your question.
Developer
Developer
Posts: 607
Registered: ‎04-29-2011
My Device: PlayBook 16GB, BB10 LE Z10 (red)
My Carrier: none

Re: Show web service data in 9700 using phone gap technology

[ Edited ]

And some recommendation for your, if possible, try to use a JSON service like functionality since JSON is the simplest way I can think of to work with data between client and server. In that way you can send Arrays easily to the client-side to work on them without any XML parsing you will need.


"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: Show web service data in 9700 using phone gap technology

hi sir i know response is coming from web service.sir can you please help me if i can say print 100 number with scrolling in fixed area after calling web service take as a example. how you will be do. if you have sample code please share. actually i am beginner.
Developer
Posts: 777
Registered: ‎07-21-2012
My Device: 9810
My Carrier: 0

Re: Show web service data in 9700 using phone gap technology

sir give me some example to show text scroll-able in some area after web service call.