Issue with

var params = arguments[0], $ = skuid.$;

var table = $(’#MyTable’),
 alert(“Hello World”);
if (table.length > 0) {
   list =‘Scholarship_Award__c’).list;
   items = list.getSelectedItems();


In the code above the first 2 alerts are shown, and the table.length is greater than 0 but the 3 alert is not shown the table is populated with data form the ‘Scholarship Award’ object.

Am I missing the obvious, do not want to use mass action on the table hence trying to use this snippet.


Clarification question regarding your code. Are you trying to get the 3rd alert to be conditionally displayed? If yes, your curly bracket is in the wrong place. If no, you can just move the 3rd alert up with the other 2?

Hope that resolves your issue!

Hello Paul -

The reason the third alert is not firing is because there is a javascript exception being encountered based on the code.  If you open up the developer console when the page is running and trigger the snippet to get called, you’ll find the details of that exception.  It will read something like 

"cannot read property of ‘list’ of undefined

If I’m understanding your code correctly, you are likely not getting any items and the alerts are simply a means for you to debug what is going wrong.

The reason for the exception is due to this line of code

list =‘Scholarship_Award__c’).list

In your code, the ‘table’ variable is an HTML DOM element accessed through jQuery.  jQuery uses selectors to access DOM elements and the ‘length’ property of the result returned is how many it found.  This is why table.length is one (1) in your case.

If you want to retrieve the list associated to the table, change your code to the following:‘object’).list

Skuid stores the “Table” component in a data property called ‘object’ on the Table DOM element.  The table component has property called list and from the list, you can then get the selected items.

Hope this helps!