This topic contains 3 replies, has 0 voices, and was last updated by Vinayak 7 years, 7 months ago.

  • Author
    Posts
  • #5852

    Vinayak

    Hello everyone,

    Is there any way to show huge bulk of data on suitelet using sublist (on or table )also along with data there will be other fields to filter those results and also one button to process that list results. I am facing performance issues. Please advice if I can achieve this using HTML or some other method like pagination or any other best method.

    Thanks
    This is a cached copy. Click here to see the original post.

  • #5853

    Olivier Gagnon NC

    Yes I have done this in the past. You can manage your own mechanism using an HTML construct (instead of NS sublist) and then maybe something like a JSON cache to manage pagination. Worked well when I did it.

  • #5854

    michoel

    Here is an example of doing something like this with DataTables for pagination

    mos_product_search.js

    Code:
    [js] /**
    * Suitelet to make searching for stock codes really easy
    *
    * Script Type: Suitelet
    *
    */

    function getItems() {

    var columns = [‘internalid’, ‘itemid’, ‘salesdescription’, ‘baseprice’, ‘lastpurchaseprice’, ‘custitem_uom’, ‘upccode’, ‘quantityonhand’, ‘vendorcode’];

    var searchcolumns = [];
    for(var col in columns) {
    searchcolumns.push(new nlobjSearchColumn(columns[col]));
    }

    var search = nlapiCreateSearch(‘item’, null, searchcolumns);
    var results = search.runSearch();
    var items = [], slice = [], i = 0;
    do {
    slice = results.getResults(i, i + 1000);
    for (var itm in slice) {
    var item = {};
    for(col in columns) { item[columns[col]] = slice[itm].getValue(columns[col]); } // convert nlobjSearchResult into simple js object
    items.push(item);
    i++;
    }
    } while (slice.length >= 1000);

    return items;
    }

    function suitelet (request, response) {

    switch(request.getParameter(‘custom_request_type’)) {

    case ‘items’:

    var items = JSON.stringify(getItems());
    response.write(items);
    break;

    case ‘html’:

    var content = nlapiLoadFile(‘SuiteScripts/MOS Customizations/productsearch/mos_product_search.html’).getValue();
    response.write(content);
    break;

    default:

    var url = nlapiResolveURL(‘SUITELET’, ‘customscript_mos_stock_code_search’, ‘customdeploy_mos_stock_code_search’);
    var form = nlapiCreateForm(‘Product Search’);
    form.addField(‘content’, ‘inlinehtml’, ”)
    .setDefaultValue(‘‘);
    response.writePage(form);
    }
    }
    mos_product_search.html

    HTML Code:


    [/js]


    david.smith replied on 04/04/2017, 10:32 AM: love datatables! great product.

  • #5855

    Vinayak

    michoel

    Hi michoel..

    the code which u have given for bulk data, I tried with the same code but I am not able to fetch data from netsuite and also m not able to show on table… I guess when I run the script then html part ill get triggered but after m not able to call Item get functionality from HTML page… when I run the code it showing me table n loading message inside the table.Please help me to to solve the issue

You must be logged in to reply to this topic.