using netsuite standard sublist with pagination in...
# ask-stanley-ai
d
using netsuite standard sublist with pagination in suitelet, when user select data on first page then navigate to the next page, the first page data selection will be cleared, how to overcome this ?
c
AI generated answer (using internal Slack threads):
In order to overcome the issue of data selection being cleared when navigating between pages in a Suitelet with a standard sublist and pagination, you can use a hidden field to store the selected values. This way, you won't lose any data when moving between pages. Here is a sample code snippet that was shared in the conversation:
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);
    }
This code listens for a field change, then updates the display of the rows based on the current page. It uses jQuery to hide or show rows based on the page number. Another approach is to change the list type to
serverWidgetSublistType.STATICLIST
. This will enable the native NetSuite controls for pagination, which automatically handle the retention of selected data when navigating between pages. Remember to update the hidden field whenever a selection is made or deselected, and populate the checkbox based on the values held in the hidden field when moving to a new list of rows. ****** 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.845114589
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.843838215
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821773291
Please provide your feedback on this answer.
111 Views