Whats the best way to handle pagination on a suitl...
# ask-stanley-ai
e
Whats the best way to handle pagination on a suitlet where the user may select options from multiple pages?
c
AI generated answer (using internal Slack threads):
Based on the conversations, there are a few ways to handle pagination on a Suitelet where the user may select options from multiple pages: 1. Using a hidden field to store selected values: You can hold selected values in a hidden field to ensure you do not lose anything and update that field whenever something is selected/deselected. When you move to a new list of rows, populate the tick box based on those values held in your hidden field. This method requires custom scripting and may not be the most efficient solution. 2. Using jQuery to hide/show lines: You can hide/show lines with jQuery and handle the hiding/showing on field change (page number). All the data is still there, the jQuery just hides different groups. Here is a sample code:
Copy code
javascript
    //listens fieldChanged
    function handlePageChange(rec, context) {
        var currPage = Number(rec.getValue(context.fieldId));
        var multiplier =100;
        var minRow = (currPage - 1) * multiplier;
        var maxRow = (currPage * multiplier) - 1;
        var lineCount = rec.getLineCount('custpage_sublistid');
        for (var i = 0; i < lineCount; i++) {
            (i >= minRow && i <= maxRow)
                ? updateRowDisplay(i, '')
                : updateRowDisplay(i, 'none');
        }
    }

    //listens handlePageChange
    function updateRowDisplay(line, displayType) {
        jQuery('#custpage_sublistidrow' + line).css('display', displayType);
    }
3. Using serverWidgetSublistType.STATICLIST: If you change the list type to serverWidgetSublistType.STATICLIST, the native controls show up and are fully functional. This method does not require any additional configuration and works the same way as the native NetSuite lists/grids. Remember, the method you choose will depend on your specific use case and requirements. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.81887567
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.807765663
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.80719775
Please provide your feedback on this answer.