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

Paged Data issue: undefined is not an object evaluating makeVirtual

1 Answer 88 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
AppsWiz
Top achievements
Rank 1
AppsWiz asked on 29 Aug 2014, 02:47 AM
Greetings, I have a question regarding the remote datasource with server paging. My attempts were not entirely successful so please shed some light on what I was doing wrong.
 
Basically I have a template that sets up the search result view that contains a listview as its content. The listview is set up via the template. I have a search button that creates the datasource that the listview reads from, and then navigate to the search result view.
 
On chrome it seems to be working ok but when I load it on a device with cordova, it throws an error saying 'undefined' is not an object evaluating makeVirtual. The only problem I noticed is that sometimes the items in the listview is not laid out properly on the first show. Maybe this has something to do with the problem I’m having?
 
Here is my code:

//this is actually assigned globally
var dataSource = new kendo.data.DataSource({
    transport: {
    read: {
     url: window.webserviceUrl + "/Search",
     dataType: "xml"
},
parameterMap: function(data, type) {
return String.format("categoryId={0}&place={1}&keywords={2}&countryName={3}&page={4}&pageSize={5}",
dataItem.id,
place,
keywords,
"Australia",
data.page,
pageSize);
   }
},
schema: {
type: "xml",
data: "/Products/product",
model: {
fields: {
                            id: "id/text()",
                            name: "name/text()",
                            highlight: "highlight/text()"
                            }
                    }
},
change: function(e) {
AW5.app.hideLoading();
},
pageSize: pageSize,
serverPaging: true
    });

    if ($("#product-list-1 .product-list").data("kendoMobileListView")) {
    $("#product-list-1 .product-list").data("kendoMobileListView").setDataSource(ds);
    }

AW5.app.navigate("#product-list-1");

///Template

    <!-- Category product list view -->
    <div id="product-list-#= instance #" data-role="view" class="member-only" data-module-instance="#= instance #" data-use-native-scrolling="true">
        <header data-role="header">
            <div data-role="navbar">
                <a class="nav-button" data-align="left" data-role="backbutton"></a>
                <span data-role="view-title">Search results</span>
            </div>
        </header>
        <ul class="product-list" data-source="ds (globally set)" data-role="listview" data-template="product-template" data-click="products.click" data-endless-scroll="true">
        </ul>
    </div>

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 01 Sep 2014, 04:03 PM
Hello,

I am afraid that the provided information is not sufficient enough in order to determine where exactly the problem comes from. Usually issues connected with server paging are caused by an incorrectly set or missing dataSource.schema.total configuration. Does your server returns the total amount of records? Please try to set the `total` and if the issue still persists try to isolate it in a sample project that I can run and test locally. In this way I will be able to examine your exact implementation in details and provide you with a concrete recommendations.

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