kregwallace / alphascroll with worklight 6.2

时间:2014-12-23 11:38:09

标签: android ibm-mobilefirst

我正在尝试将alphascroll栏用于我的项目。 我按照指南:https://github.com/kregwallace/alphascroll

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="viewport" id="viewport"
    content="width=device-width,minimum-scale=1.0,maximum-scale=10.0,initial-scale=1.0" />
<title>AlphaScroll Demo</title>
<link rel="stylesheet" type="text/css"
    href="css/jquery.mobile-1.2.0.min.css" />
<link rel="stylesheet" type="text/css"
    href="css/jquery.mobile.alphascroll.css" />
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile-1.2.0.min.js"></script>
<script type="text/javascript" src="js/jquery.mobile.alphascroll.js"></script>
<script>
    window.$ = window.jQuery = WLJQ;
</script>
<script>
    $(document).ready(
            function() {
                names = [ "Hannah Gilbert", "JaMarcus Davidson",
                        "Sofia Wesley", "Mark Smith", "Genesis Hailey",
                        "Amelia Webster", "Leah Hodges", "Jocelyn Higgins",
                        "Madelyn Galbraith", "Gabrielle Wayne",
                        "Elizabeth Cook", "Zoe Calhoun", "Natalie Sheldon",
                        "Maya Geraldo", "Isabelle Morrison", "Maria Turner",
                        "Lauren Hoggarth", "Madelyn Osborne", "Vanessa Nash",
                        "Khloe Mercer", "Rachel Garblinski", "Steven Goldman",
                        "Hailey Carrington", "Judith Brickman", "Julia Oliver",
                        "Jasmine Abramson", "Brooke Creighton",
                        "Sophie Wainwright", "Gabriella Walkman",
                        "Archibald Carrington", "Isabella Haig",
                        "Peter Carrington", "Gabrielle Crofton",
                        "Makayla Chandter", "Miles Turner",
                        "Isabelle Wainwright", "Andrew WifKinson",
                        "Brenda Brown", "Scotty Nash", "Ariana Clapton",
                        "Peyton Fulton", "Victoria Brown", "Molly Daniels",
                        "Cynthia Monroe", "Payton Thomson",
                        "Payton Wainwright", "Kylie Webster", "Harry Chiglitz",
                        "Lawrence Gilson", "Olivia Cook", "Henry Miller",
                        "Natalie Smith", "Zoey Wainwright",
                        "Charlotte Gardner", "Ira Wallace",
                        "Samantha Brickman", "Hannah Galbraith",
                        "Kayla Davidson", "Nevaeh Osborne",
                        "Gabrielle Chesterton", "Katherine Hamphrey",
                        "Jerry Michaelson", "Victoria Gibbs", "Barry Goodman",
                        "Vincent Wilthorpe", "Barney Mercer",
                        "Camilla Kapinksy", "Jessica Cook", "Kaitlyn Vaughan",
                        "Evelyn Nash", "Trinity Neal", "Melanie Oswald",
                        "Sophia Goldman", "Kimberly Nathan", "Ashley Carter",
                        "Elizabeth Abramson", "Vinny Amarillo",
                        "Layla Gardner", "Irma Nathan", "Leah Galbraith",
                        "Katherine Miln", "Caroline Miller", "Ernie Carter",
                        "Winston Smith", "Fyodor Dostoevsky", "Neville James",
                        "Lucrecious Carter", "Zebediah Jones" ];
                names.sort();
                var namesListHTML = '';
                $.each(names, function(i) {
                    namesListHTML += '<li data-icon="false"><a href="#"><h3>'
                            + names[i] + '</h3></a></li>';
                });
                $('#mylistview').append(namesListHTML);
                WL.Logger.info("prima");
                $('#mylistview').listview('refresh').alphascroll();
                WL.Logger.info("prima");
            });
</script>
</head>
<body>
    <div id="alphascroll" data-role="page">
        <div data-role="header" data-position="fixed">
            <h1>AlphaScroll</h1>
        </div>
        <div data-role="content">
            <ul id="mylistview" data-role="listview" data-autodividers="true"></ul>
        </div>
        <div data-role="footer" data-position="fixed">
            <div data-role="navbar">
                <ul>
                    <li><a data-icon="star" href="#">Link 1</a></li>
                    <li><a data-icon="star" href="#">Link 2</a></li>
                    <li><a data-icon="star" href="#">Link 3</a></li>
                </ul>
            </div>
        </div>
    </div>
    <script src="js/initOptions.js"></script>
    <script src="js/main.js"></script>
    <script src="js/messages.js"></script>
</body>
</html>

添加了所有js文件。 运行应用程序时,我的listview没有metod .listview('refresh')的logcat打印.alphascroll();

如果我用浏览器打开它,就像演示一样。 我能做什么?

1 个答案:

答案 0 :(得分:0)

Worklight Studio 6.2在您的应用中包含jQuery v1.9.1。没有必要自己包含它,即删除以下内容:

<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>

此外,将以下代码作为 head

中的第一个脚本标记移动
<script>
    window.$ = window.jQuery = WLJQ;
</script>