Hi there,
I have a virtual list that is getting all the data from an api via a get request and it works well and surprisingly fast on the browser considering it is fetching upwards of a 1000 records. However, when testing on my iOS device, it doesn’t seem to work, it just keeps loading. I left it to run for 10 minutes but still had no luck. My code is below:
export default {
data: function() {
return{
items:[]
}
},
on: {
pageBeforeRemove: function () {
var self = this;
self.virtualList.destroy();
},
pageInit: function() {
var self = this;
var app = self.$app;
self.virtualList = app.virtualList.create({
el: self.$el.find(’.virtual-list’),
items: self.items,
searchAll: function (query, items) {
var found = [];
for (var i = 0; i < items.length; i++) {
if (items[i].Name.toLowerCase().indexOf(query.toLowerCase()) >= 0 || query.trim() === ‘’) found.push(i);
}
return found; //return array with mathced indexes
},
itemTemplate:
’
’ \n’ +
’ \n’ +
’ \n’ +
’
’
‘
’
’ \n’ +
’
// Item height
height: app.theme === ‘ios’ ? 63 : (app.theme === ‘md’ ? 73 : 46),
});
var filter = self.filter;
app.preloader.show();
app.request({
url:'api url'',
method:'GET',
async:false,
dataType:'json',
success: function(data, textStatus ){
self.virtualList.replaceAllItems(data.result.records);
app.preloader.hide();
},
});
}
}
};