dclarke
11/28/2018, 10:46 AM.addButton
on my form, and then printed the output of the function as time goes on by appending to innerHTML. On Firefox, this works fine. On Chrome, the page completely freezes until the function is complete, and then suddenly all the output displays. I’m using mostly nlapiLoadSearch
which I think is render-blocking - is there any way around this?Nik
11/28/2018, 10:49 AMdclarke
11/28/2018, 10:51 AMdclarke
11/28/2018, 10:51 AMSS code: form.addButton('custpage_newdl', 'Download', 'getPricelistItems()');
CS Code:
function getPricelistItems() {
var diff;
var f;
document.getElementById("div__body").innerHTML += "<br />"+'(1/6) Loading pricelist...';
var reportChoice = nlapiGetFieldValue('custpage_report');
var priceChoice = nlapiGetFieldText('custpage_price_level');
var customerChoice = nlapiGetFieldValue('custpage_customer');
reportChoice = pListIds[reportChoice];
var search = nlapiLoadSearch('customrecord_price_list_items', 'customsearch_price_list_items');
var filter = new nlobjSearchFilter('custrecord_pli_price_list', null, 'anyof', reportChoice);
var columns = search.getColumns();
search.addFilter(filter);
var results = search.runSearch().getResults(0, 1000);
if(results) {
if (results.length === 1000) { results = searchMore(search, results); }
var priceListProducts = [];
var priceListOrder = [];
if (results && results.length > 0) {
for (i; i < results.length; i += 1) {
if(results[i].getValue(columns[2])!='T') { //Column 2 ('header') should be false
priceListProducts.push(results[i].getValue(columns[1]));
}
priceListOrder.push({'code':results[i].getValue(columns[1])});
}
}
}
}
dclarke
11/28/2018, 10:52 AMNik
11/28/2018, 11:08 AMNik
11/28/2018, 11:10 AMNik
11/28/2018, 11:13 AMdclarke
11/28/2018, 11:31 AM