使用phon2 gap技术无法在黑莓中的非触摸设备中滚动列表

时间:2012-07-31 09:07:09

标签: blackberry-webworks

我无法滚动列表。我正在使用此代码,请给我一些建议。

<!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" />
    <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">

        function GetDepartureStationDashboard()
        {      
             var pl = new SOAPClientParameters();
             var params = getParams();
             var parameter1 = unescape(params["getStationCode"]);
             var parameter2 = unescape(params["getStationDesc"]).replace(/[+]/g,"  ");
             document.getElementById("headingcontent").innerHTML = parameter2;
             pl.add("parameter1", parameter1);
             SOAPClient.invoke(WSDLURL, "GetDepartureStationDashboard", pl, true,  GetDepartureStationDashboard_callBack);
        }
        function GetDepartureStationDashboard_callBack(r)
        { 

// list which i want to scroll
            alert(r);// web service data
            var listdata = ""; 
            //tabledata += "<ul x-blackberry-focusable=\"true\">";
            //alert(""+r[0].stationName);
            for (var i = 0; i < r.length-1; i++)
            {
              //    
                listdata += "<li x-blackberry-focusable=\"true\"  id=\"i\"  x-blackberry-onUp=\"scroll(r.length-1)\" x-blackberry-onDown=\"scroll(r.length-1)\">" + r[i].stationName + "</li>";     
            }
            //listdata += "</ul>";
            alert(listdata);
            document.getElementById("iscroller").innerHTML = listdata;
        }

    </script>
</head>
<body onload="GetDepartureStationDashboard()">
<div id="wrapper">
  <div class="login_cont" x-blackberry-focusable="true">
    <div class="home_icon"><a href="index.html"><img src="images/back-icon.png" alt="Home" title="Home" x-blackberry-focusable="true"/></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'" x-blackberry-focusable="true"/>
            <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%">Destination</td><td width="5%">STATUS</td>
                </tr>
            </table>
          </div>
          <div class="scroll-pane">

              <ul id = "iscroller" x-blackberry-focusable="true">
              </ul>

        </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>

1 个答案:

答案 0 :(得分:0)

我建议如下:

  1. 确保没有发生运行时错误。我在您的代码中没有看到任何try-catch语句,因此如果任何一行JavaScript失败,它可能会影响整个应用程序。
  2. 我看到iScroll的引用。该库无法保证在BlackBerry上运行(它专为其他平台设计),特别是在某些设备上,因为它与BlackBerry Web引擎的自然动态滚动冲突。如果您确实遇到了您认为植根于iScroll的问题,请report it致开发人员。
  3. 如果您使用的是BlackBerry 7,则可以使用远程Web检查器来调试和配置实时内容。 This technique可以帮助您找到问题的根源。