I have the following
/// gets the data from the webserver
GetAllData = function (url, callback, additionParamString){
var dataSource = new kendo.data.DataSource({
transport: {
read: {
// the remote service url
url: url +'&JsonCallback=?',
// JSONP is required for cross-domain AJAX
dataType: "jsonp",
// additional parameters sent to the remote service
data: {
q: "html5"
}
}
}
});
return dataSource;
}
function ShowDirectoryForCategory(e){
var category = e.view.params.id;
var url = URL_Directory_ROOT +'&category='+category;
e.view.element.find("#uxDirectoryList").kendoMobileListView({
template: kendo.template($("#templateForDirectoryListingItem").html()),
dataSource:GetAllData( url,null,'')
});
}
sometimes when calling ShowDirectoryForCategory it crashes the app (I am using xCode via phoneGap 2....) - this is only on a device - if I have it connected I get a memory warning ...
should I be clearing the data somehow... ?? sometimes there is a "lot" of data there times not.. is there a limit on the size of data transfered>>??
and
20 Answers, 1 is accepted
We are not really sure how often the ShowDirectoryForCategory method is called. However it is not a good idea to initialize a kendo widget more than once.
I suggest you initialize your listview only once. Modify the datasource configuration so the url setting is a function:
ransport: {
read: {
url: function() {
var url = getUrlForCurrentCategory(); // you need to implement this function based on your requirements - current category etc.
return url;
},
dataType: "jsonp"
}
}
If you need further assistance please attach a sample project which we can check.
Atanas Korchev
the Telerik team

so how do I stop initializing the listview.
You shouldn't stop initializing the list view. You should initialize it only once.
If you need further assistance please attach a sample project which we can check.Regards,
Atanas Korchev
the Telerik team

thanks
attached is a cobble together of the code.
please see the index.html page and the assets/js/FuzzelogicSolutionsTreetoFramework.js files
the main methods in the js files are
function ShowDirectoryForCategory(e)
function ShowMainMenu (e)
with datasources around line 105.
I want to maximise the reuse - SO I don't want to create a new ds for everything.
You can try using the init event of the view instead of show. That way the ShowMainMenu method will be executed only once. Here is a code snippet:
<div id="pgHome"
data-role="view" data-layout="layout-Main"
data-init="ShowMainMenu"
data-title="Home">
Atanas Korchev
the Telerik team

thnx
but if its executed once - it won't be able to dynamically build the menu when it changes on the server. ?
also when I do - the menu shows, but the categories fail.
We are not really sure what your business requirements are and how your application should behave. For example we don't really know what "it won't be able to dynamically build the menu when it changes on the server. ?" means. Some explanation how this "menu" is built from the "server" are needed.
All in all you should try not to initialize the ListView more than once. I've shown one way to do so via the init event.
Atanas Korchev
the Telerik team

It seems that it cannot handle the amount of data returned from >
http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&category=Restaurants&JsonCallback=jQuery1710935744249029085_1352669252906&_=1352669276206
This crashes an ios App - simulator is fine, web is fine......
this sucks and this is going to be a deal breaker for me if kendo cannot load this data. I say Kendo cos I have an old version of this built using MonoTouch and it loads this data no problems
Thanks
I tried to recreate the problem but making a request to http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&JsonCallback=jQuery17205324998481664807_1353311467125 returned an exception (actual browser screen is attached as a screenshot). Can you provide a working JSONP endpoint which we can test with?
Atanas Korchev
the Telerik team

Thank you - I am REALLY REALLY sorry.. must be too late
here's the correct link it was missing the category
http://treetolocal.fuzzelogicsolutionslabs.im/mobileapi/getdirectorylistingsfor?local=iom&JsonCallback=jQuery17205324998481664807_1353311467125&category=Restaurants
you can try category=Taxi
and category=ITServices
Hope this help
PLease remember this issue is from ios device only built using phonegap
Thank you again.
I created a live demo using your data: http://jsbin.com/iburuy/1/edit. You can check just the demo here: http://jsbin.com/iburuy/1
I tested it on iPhone 4 and iPad 3 and everything worked as expected.Regards,
Atanas Korchev
the Telerik team

Thanks -
that is very very similar to what I have -
the issue is when I do a data-show - when the category changes from Restaurant to say Taxi ..
Please modify the example so it mimics your scenario. We cannot really help without reproducing the problem first.
Regards,Atanas Korchev
the Telerik team

I've tried to update the sample - > http://jsbin.com/iburuy/3/edit
but as you see I have no way of refreshing the data source.
Thanks for updating the sample. I think I now understand what you are trying to achieve.
In this case it is best to use the read method of the data source to set the new category. The initial category is specified from the data setting of transport.read
Here is the updated example: http://jsbin.com/iburuy/7/edit
Atanas Korchev
the Telerik team

I will try this on the device - fingers crossed it will work and not cause a app shut down - thank you for your patience :)

just tried it, and got ...
2012-11-20 14:58:38.565 treetoLocal[5930:707] Multi-tasking -> Device: YES, App: YES
2012-11-20 14:59:34.695 treetoLocal[5930:707] Received memory warning.
2012-11-20 14:59:36.534 treetoLocal[5930:707] Received memory warning.
then it closed the app.. :(This example has been tested on various iOS devices (by navigating with Safari to http://jsbin.com/iburuy/7). No memory errors were observed. How do you deploy this example? What are the required steps to reproduce this locally?
All the best,Atanas Korchev
the Telerik team

if you give me an email address - I can email you the complete project - prefer not to put in on here .
We just tested in a phonegap project as well. Still everything worked as expected (both in the simulator and on an iphone 4 device). Find attached our xcode project as well as a recording showing how things work at our end. Does the attached project work at your side?
Regards,Atanas Korchev
the Telerik team