📌  相关文章
📜  Zoho Creator Javascript 循环遍历 200 多条记录 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:49.703000             🧑  作者: Mango

代码示例1
var recordOps = ZOHO.CREATOR.API;
var creatorSdkPromise = ZOHO.CREATOR.init();

var user = "";
var counter = 0;

creatorSdkPromise.then(function (data) {
     getData("1");
});

async function getData(page_num) {
    
    var reportLinkName = "Your_Report_Name";
    var config = {reportName: reportLinkName, page : page_num, pageSize : "200"};
    var getRecords = recordOps.getAllRecords(config);
    getRecords.then(function(jsonData) {
        
        $.each(jsonData.data, function(idx, value) {
            
                        // Parse your data here
                        counter += 1;
            console.log(counter + ": " + value.ID);
        });
        
        var num_of_records = Object.keys(jsonData.data).length;
        if(num_of_records == 200) {
            
            getData(parseInt(page_num) + 1);
        }
    }).catch(err => console.log("No matching records"));
}