dennysutanto
10/10/2024, 5:44 PMCeligo AI
10/10/2024, 5:45 PMAI 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:
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.
******Celigo AI
10/10/2024, 5:46 PMSlack 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
Celigo AI
10/10/2024, 5:46 PM