MVC4 Classic
Read Remote Data

You can use the following code to read remote data using a proxy:

// define a proxy
var proxy = new wijhttpproxy({
            url: "http://ws.geonames.org/searchJSON",
            dataType: "jsonp",
            data: {
                featureClass: "P",
                style: "full",
                maxRows: 12,
                name_startsWith: 'ab'
            },
            key: 'geonames'
        });
// define a reader
var myReader = new wijarrayreader([
    {
        name: 'label',
        mapping: function (item){
            return item.name + (item.adminName1 ? ", " + item.adminName1 : "") + ", " + item.countryName
        }
    },
    {name: 'value',mapping: 'name'}]);
// create datasource
var datasource = new wijdatasource({
    reader: myReader,
    proxy: proxy,
    loaded: function (data){
        // read items.
        var items = data.items;
    }
});
// trigger load.
datasource.load();

See Also

Dialog

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum |  Documentation Feedback