Skip to main content
Nintex Community Menu Bar
Question

Javascript for rows that are checked in a table?

  • July 9, 2024
  • 5 replies
  • 1 view
  • Translate

Forum|alt.badge.img+7

I need to write some code to run a loop only on the rows that are checked in a table. How do I reference the checked table rows in javascript?

Did this topic help you find an answer to your question?
This topic has been closed for comments

Forum|alt.badge.img+11

You’ll need to give your table a unique name e.g. my-table.

var myTable = skuid.$('#my-table').data('object');<br>var selectedItems = list.getSelectedItems();<br>$.each(selectedItems, function (i, item) {<br>&nbsp; &nbsp; console.log(i + ' - ' + item);<br>});






Translate

Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

Thanks Irvin

Translate

Forum|alt.badge.img+13

Another Community post that might be helpful here:

https://community.skuid.com/t/how-to-add-marketo-send-email-mass-action-to-a-skuid-tab…

And here’s the documentation on writing Mass Action Snippets, which leverage the “getSelectedItems()” behavior Irwin described:

http://help.skuidify.com/m/11720/l/204930-table-component-custom-mass-actions

Translate

Forum|alt.badge.img+7

Thanks everyone! We got it working as a mass action…

var params = arguments[0], $ = skuid.$,
    action = arguments[0].action,
    list = arguments[0].list,
    model = arguments[0].model,
    selectedItems = list.getSelectedItems();

var SessionModelId=skuid.model.getModel(“MMA_Academy_Student_Event_Session_included”).data[0].Id;

if(SessionModelId) {

    var SessionPerformerModel=skuid.model.getModel(“MMA_Academy_Student_Event_Session_Perfor”);

    $.each( selectedItems,
        function( i, item )
        {
            var row = item.row;
            console.log(row.Id);
            var newRow=SessionPerformerModel.createRow({
                additionalConditions: [
                    {field:‘MMA_Academy_Student_Event_Performer__c’, value:row.Id},
                    {field:‘MMA_Academy_Student_Event_Session__c’, value:SessionModelId},
                    
                    ], doAppend: true
            });
        });
        SessionPerformerModel.save({callback: function(result){
        if (result.totalsuccess) {
            alert(‘Performers were added to the selected sessions’);
        } else {
            console.log(result.insertResults);
            console.log(result.updateResults);
            console.log(result.deleteResults);      
        }
    }});
}

else{
    alert(‘Select a session to add the performers to.’);
}


Translate

Forum|alt.badge.img+17
  • Nintex Employee
  • July 9, 2024

I’m glad you got it working!  Cheers! 

Translate

Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie Settings