Getting the selected records on a table without using mass/row action and instead using a button

Hello!

When starting a snippet using code such as that shown below, is it possible to pull in selected items from a table by clicking on a title button that launches a snippet or does the snippet always have to be run from a mass action or row action on the table?

Cheers guys!

var params = arguments[0], $ = skuid.$, items = params.item ? [params.item] : params.list.getSelectedItems()<br>

Yes, you just need to get a reference to the Table’s list. This is doable several ways, but the easiest way is to give your Table a Unique Id, e.g. “MyTable”, and then you could call this from your button:

var table = skuid.$(’#MyTable’),
   list,
   items;
if (table.length) {
   list = table.data(‘object’).list;
   items = list.getSelectedItems();
}

Worked a treat!

Cheers Zach. This will be tremendously useful.

Needed this code tonight – Thanks!!!