no access to datastore on url-loaded list

Hi
I’m having issues with accessing the data inside a list loaded from a rest get request. The content is loaded alright but the datastore functions seem to be disconnected (e.g. count() returns 0). If I replace the data by inline json data it works fine…
var ui_list = { id:"itemsList", view:"list", //url:'./items' data:[ { id:1, title:"The Shawshank Redemption", year:1994, rank:1}, { id:2, title:"The Godfather", year:1972, rank:2} ]

var list = $$('itemsList'); console.log(list.count()); // returns 2 if using the data // returns 0 if using the url

Any idea of what might be going wrong under the hood?

Hi,

you need to use “proxy”. Please check the following docs:

http://docs.webix.com/desktop__server_proxy.html

Thanks!

By the way, json which you are using is not valid. ( not escaped keys ) so it will not work for Webix 3.0

http://screencast.com/t/JFXkoFka

Sorry. “proxy” does not relate this issue. Please check that you are calling list.count() after data loading (loading is asynchronous):

webix.ui({
    view: "list",
    url: "...",
    on:{
         onAfterLoad: function(){
              alert(this.count())
         }
    },
    ...
});