对于每个循环以相反的顺序运行

时间:2015-08-27 13:54:36

标签: javascript

我必须从服务器循环一些数据并导出到csv文件。在导出时,我以相反的顺序获取数据。

在下面的代码中,索引从第一个元素开始并推送数据。有没有办法可以循环最后一个元素的数据。索引应该从最后一个元素开始,然后到第一个

代码:

      $.each(exportArray, function (index, value) 
    {                   
                        csvData.push(ProcurementRelatedUID[index] + "," +           ProcurementPurchaseId[index] + "," + ProcurementVendorName[index] + "," + ProcurementPlant[index]  + ","+ ProcurementPlannedDeliveryTime[index] + "," + ProcurementStorage[index] + "," + ProcurementInHouseProductionTime[index] + "," + ProcurementGRProcessing[index]);
                        });

        csvData = 'data:application/csv;charset=utf-8,' + encodeURIComponent(output);

       $(this)
        .attr({
        'download': filename,
            'href': csvData,
            'target': '_blank'

    });

0 个答案:

没有答案