SAMPLE CODE:
We can write a client script 2.0 function in NetSuite to get the button click of the “Mark All” and “Unmark All” buttons in a custom Suitelet page using the following steps:
- In the client script file, create a function that will be triggered when the “Mark All” or “Unmark All” button is clicked. We can use the
jQuerylibrary to select the button elements by their class or ID.
javascriptCopy codefunction buttonClickHandler() {
// Get the button elements by class or ID
var markAllButton = jQuery('.mark-all-button');
var unmarkAllButton = jQuery('#unmark-all-button');
// Attach a click event listener to the buttons
markAllButton.on('click', function() {
// Code to handle "Mark All" button click
});
unmarkAllButton.on('click', function() {
// Code to handle "Unmark All" button click
});
}
- In the same client script file, call the
buttonClickHandlerfunction when the custom Suitelet page is loaded. You can use thepageInitfunction to achieve this.
javascriptCopy codefunction pageInit(context) {
buttonClickHandler();
}
This code will attach click event listeners to the “Mark All” and “Unmark All” buttons on your custom Suitelet page. You can then add your code inside the event listeners to handle the button clicks as required.