Lawnchair Phonegap Iteration Script

时间:2012-10-07 17:19:08

标签: javascript json cordova lawnchair

我正在使用Lawnchair进行持久存储的HTML5 iOS App开发。

我有一个迭代脚本,返回未定义的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);
        }

    })
})

数据显然位于本地存储中,但未正确迭代,是否有人可以为此提供修复? 感谢

1 个答案:

答案 0 :(得分: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
    }

})