Snippet code to deselect selected table rows

  • 1
  • Question
  • Updated 5 years ago
  • Answered
Hello!

Is there some javascript code I can use at the end of a mass action snippet to deselect selected rows on a table? This is so that the process can be repeated using a different mass action without having to deselect the records in between.

Thanks for the help!
Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
  • splendid

Posted 5 years ago

  • 1
Photo of Zach McElrath

Zach McElrath, Employee

  • 49,056 Points 20k badge 2x thumb
Hi Louis,

Here's a basic Mass Action Snippet that will alert the Names of the selected Rows, then unselect the selected Items:

var params = arguments[0],    
    list = params.list,
    selectedItems = list.getSelectedItems(),
    $ = skuid.$;
var rowNames = $.map(selectedItems,function(item){return item.row.Name;});
alert(rowNames.join('\n'));
$.each(selectedItems,function(i,item){
    item.selected = false;
});
list.render({
    doNotCache:true
});


Photo of Louis Skelton

Louis Skelton

  • 4,878 Points 4k badge 2x thumb
Thanks Zach! Worked a treat. Have a good weekend!