Skip to main content
Nintex Community Menu Bar
Question

Inline JS within Popup


Forum|alt.badge.img+3

I have this inline JS code which I use for drag and drop functionality within table. It works fine when the table is on the main page but now I am trying to execute this within a popup. Any tips?

(function(skuid){var $ = skuid.$;
$(document.body).one(‘pageload’,function(){
var component = skuid.$C(‘sk-3MxwBj-240’),
   listContents = component && component.element.find(‘.nx-list-contents’);
listContents.sortable({
   placeholder: “ui-state-highlight”,
   stop: function( event, ui ) {
       var data = ui.item.data(‘object’),
           model = data.list.model,
           movedRow = data.row,
           target = $(event.target);
       
       target.children().each(function(index,tr){
           var row =  $(tr).data(‘object’).row,
               order = row.Order__c;
          if (index + 1 !== order) {
              model.updateRow(row,‘Order__c’,index+1,{initiatorId:component._GUID});
          }
       });
           
   }
});
});
})(skuid);

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

7 replies

Forum|alt.badge.img+9
  • Nintex Employee
  • 889 replies
  • July 10, 2024

Hi Danny. Does the code above reference a unique ID for the table component? “sk-3MxwBj-240” may need to be changed if it should refer to a different component in the popup.

Translate

Forum|alt.badge.img+3
  • Author
  • 12 replies
  • July 10, 2024

yes that is referencing the new table within the popup.  I believe the issue is that this JS is inline which means it executes after the main pages loads where as I need this to execute after the popup loads.

Translate

Forum|alt.badge.img+9
  • Nintex Employee
  • 889 replies
  • July 10, 2024

Okay. In that case, you might need to set up a second (matching) JS inline Snippet for the popup, and trigger that as one of the actions that happens when the popup is opened. Is the popup showing a page include, or is it all part of one page?

Translate

Forum|alt.badge.img+3
  • Author
  • 12 replies
  • July 10, 2024

I tried that as well. I have a button which when clicked opens the popup.  The action after that renders a snippet.  That did not seem to work either. Let me know if you were referring to a different type of action.

Translate

Forum|alt.badge.img+9
  • Nintex Employee
  • 889 replies
  • July 10, 2024

That’s along the lines of what I had imagined. You may also need to remove or replace the line

$(document.body).one('pageload',function(){

since the pageload event doesn’t happen when the button is clicked.

Translate

Forum|alt.badge.img+3
  • Author
  • 12 replies
  • July 10, 2024

Ok I will try this thanks

Translate

Forum|alt.badge.img+3
  • Author
  • 12 replies
  • July 10, 2024

That worked thanks!

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