This is a migrated thread and some comments may be shown as answers.

ListView not binding in Android WebView

1 Answer 62 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Gary Bailey
Top achievements
Rank 1
Gary Bailey asked on 23 Jun 2012, 07:15 PM
I am attempting to write an app via Titanium and implementing the Kendo UI. It took me a few days to find the right combination of JavaScript libraries, but I finally got it working. I've now moved onto attempting to get data (into a ListView to start). The following code snippets do work on iOS with the same setup, so it may have something to do with Android's, but I would appreciate any pointers to something I may be missing:

The HTML file looks like:

<html>
     <head>
        <!-- Style sheets -->
        <link href="../css/kendo.mobile.all.css" rel="stylesheet"/>
         
        <!-- Javascript libraries -->
        <script src="../js/jquery-1.7.1.js" type="text/javascript"></script>
        <script src="../kendo/kendo.all.min.js" type="text/javascript"></script>
     </head>
<body>
<div data-role="view" id="content-options" data-title="Data View 1">
    <header data-role="header">
        <div data-role="navbar">
            <span data-role="view-title">Header</span>
        </div>
    </header>
  
    <div id="header-info">
        <img src="../images/img-142.jpg" alt="img" />
        <div class="version">Some text</div>
        <div class="release-date">XX/XX/XXXX</div>
    </div>
      
    <ul data-role="listview" id="package-list" data-style="inset">
    </ul
</div>
 
<script>
     var app = new kendo.mobile.Application(document.body, {layout: "default"});
</script>
</body>
</html>


The JSON Array of data is received in a call back from the Titanium framework to the HTML page where it hands off data from the database.

<script>
    Ti.App.addEventListener('packageDataResponse',function(responseData) {
        var dataSource = new kendo.data.DataSource({
                data: responseData.message
            });
         
        $("#package-list").kendoMobileListView({
                template: "${title}",
                dataSource: dataSource
            });
    });
</script>


And finally, here's some sample data that comes back to the HTML 5 after the JavaScript call:

responseData.message = [
    { packageid: "1", title: "Package 1", description: "Description for Package 1" },
    { packageid: "2", title: "Package 2", description: "Description for Package 2" },
    { packageid: "3", title: "Package 3", description: "Description for Package 3" },
    { packageid: "4", title: "Package 4", description: "Description for Package 4" }
];


As I said, this all seems to come through just fine when I load it up on iOS, but in the Android WebView, I get the following JavaScript:

Uncaught ReferenceError: title is not defined (2:file:///android_asset/Resources/HTML/en/index.html)

It seems like it can't locate the title attribute of the JSON array, but I don't see any reason why it wouldn't. Has anyone else run into this? Any suggestions from the Kendo folks?

Thanks!

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 28 Jun 2012, 08:08 AM
Hi Gary,

I am afraid that the provided information is not sufficient enough to determine where the problem comes from. The issue might be connected with the Titanium framework, so I would like to recommend opening a support ticket with small but runnable Titatium sample project attached. Thus way we would be able to see and reproduce the problem on our side, examine your case in details and do our best to advise you further.

Regards,
Alexander Valchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ListView (Mobile)
Asked by
Gary Bailey
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Share this question
or