Skip to main content

Is there a better way to get my custom component to fire when a data model is updated?  Right now we are listening for changes on the DOM -  like when the save button is pressed:



$('#myTableComponent .nx-actionselect .nx-actionselect-text').bind('DOMSubtreeModified', function() {
        certChart.init();
    });

Use Model Actions to either run a Snippet or Publish an Event that runs your Component init logic. The Model Actions allow you to bind to specific Model events and then run any action in the Action Framework. So for instance in the screenshot below, we are setting the “Initiating Event(s)” such that whenever any row in the Account Model’s “Name” field is updated, we will run a set of Actions. The Actions we’re going to run, as the 2nd screenshot shows, is “Publish Event”. We will publish a custom event, e.g. “certChart:init”. Then in your code, you just need to subscribe to that event, as in the code sample below:

b0780dbca1fcc54b469ba9cc1f204e8567875a72.png

07c95bd200b67728d68d8b62dd903766243581c7.png


skuid.events.subscribe('certChart:init',function(){<br>&nbsp; &nbsp;certChart.init();<br>});


For more information on the Skuid Events framework, read the docs.