2016-04-01 14 views

cevap

0

Eğer sanal-dizi modül kullanabilirsiniz gerektiğinde yük öğeyi dinamically istiyorum.

Link to documentation info

Link to documentation examples fikri, ilk boyutu ve ayrıca loadSize örnek özelliğine sahip olduğu gözlemlenebilir sanal diziyi createa olabilir. Sonra itemsLoadingEvent'da yeni kaynakların yüklenmesini kontrol edebilirsiniz. Bu örnek uygulamasında bulabilirsiniz bu işlevsellik için

var array = new virtualArrayModule.VirtualArray(100); 
 
array.loadSize = 15; 
 
array.on(virtualArrayModule.VirtualArray.itemsLoadingEvent, function (args) { 
 
    // Argument (args) is ItemsLoading. 
 
    // args.index is start index of the page where the requested index is located. 
 
    // args.count number of requested items. 
 
    // 
 
    // Note: Virtual array will divide total number of items to pages using "loadSize" property value. When you request an 
 
    // item at specific index the array will raise "itemsLoading" event with "ItemsLoading" argument index set to the first index of the requested page 
 
    // and count set to number of items in this page. 
 
    // 
 
    // Important: If you have already loaded items in the requested page the array will raise multiple times "itemsLoading" event to request 
 
    // all ranges of still not loaded items in this page. 
 
    var itemsToLoad = new Array(); 
 
    for (var i = 0; i < args.count; i++) { 
 
     itemsToLoad.push(i + args.index); 
 
    } 
 
    array.load(args.index, itemsToLoad); 
 
});

Daha ileri örnekler here

İlgili konular