2012-10-07 50 views
0

我正在使用Lawnchair進行持久存儲的HTML5 iOS應用程序開發。Lawnchair Phonegap迭代腳本

我有一個迭代腳本返回undefined 11倍,這裏是腳本

var lawnchair = Lawnchair({name:'relaxed', record:'config'}, function(people){ 

    this.all(function(record, index) { 
     records = record.length; 
     couchURL = record.couchURL; 
     alert(records); 

     for(i = 0, len = records; i < len; i++){ 
      console.log(couchURL); 
     } 

    }) 
}) 

數據顯然是在本地存儲,但沒有被正確地迭代出來,可能有人提供了這樣一個解決? 感謝

回答

0

試試這個:

var lawnchair = Lawnchair({name:'relaxed', adapter:'dom'}, function(people){ 

}) 

this.all(function(data) { 
    for(var i = 0; i<data.length;i++) 
    { 
     Get data using this...data[i].value.fieldname 
    } 

})