Widgets > Wijdatasource > Read Local Data |
You can use the following script to read local data:
// array to read
var testArray = ["c++", "java", "php", "coldfusion", "javascript", "asp", "ruby", "python", "c", "scala", "groovy", "haskell", "perl"];
// create datareader of array
var myReader = new wijarrayreader([{name: 'label'}, {name: 'value'}, {name: 'selected',defaultValue: false}]);
// create datasource
var datasource = new wijdatasource({
reader: myReader,
data: testArray,
loaded: function (data){
// get items by data.items
var items = data.items;
}
});
// load datasource, loaded event will be fired after loading.
datasource.load();