I have a interactive grid. If no rows selected I want to display a error msg as 'No records selected'. If more than 1 record selected then display 'select 1 record'. If 1 row selected then call a procedure. How can I achieve this using Java Script?
The error message should appear as inline notification.
I have tried this code. But this doesn't give correct error message. If I try clicking one record it is giving correct error msg then if I click one more record the error msg is incorrect. I mean whatever error I'm getting for first time I'm getting the same error always.
var gridView = apex.region("your-IG-static-id").widget().interactiveGrid("getViews").grid;
var records = gridView.getSelectedRecords();
var recs = records.length;
if (recs = 0) {apex.message.alert("No records selected")};
if (recs > 1) {apex.message.alert("Select 1 record")};
if (recs = 1) {
apex.server.process("CALL_YOUR_AJAX_PROCESS", {
x01: $v("PAGE_ITEM_1") ,// Parameters to pass to AJAX process if any
x02: $v("PAGE_ITEM_2") ,// Parameters to pass to AJAX process if any
}, {
//pageItems: ''
//dataType: 'text'
}).done(function (pData) {
console.log(pData);
});
};