When clicking on a row action or editing a record, I would like to disable certain buttons.
Example 1: When clicking on row action to view an existing contact, I would like the cancel button greyed out and disabled. You dont cancel an existing contact, but when you are editing the contact on the same page, you need a cancel button to cancel any changes the user has made.
Example 2: When clicking a custom edit button, I would like the button to be greyed out and disabled. Then after a custom save button is clicked, make the button active and enabled.
Page 1 / 1
Thanks Moshe.
Similar use case where I had to provide a global Save button with multiple actions. Here’s the code:
- Create a snippet responsible for enabling/disabling the button
- Register the snippet and call it during page load
- Create a model action to execute the snippet (in my case I do it for initiating events and all fields
- So far is working nicely
On-load JS
(function(skuid){ <br>var $ = skuid.$;<br> <br> // Register a snippet to run <br> skuid.snippet.registerSnippet('EnableDisableGlobalSaveButton', function(){<br> var model = skuid.model.getModel('QuoteLineItems');<br> if (model.hasChanged) {<br> $('#globalSaveButton').button('enable');<br> } else {<br> $('#globalSaveButton').button('disable');<br> }<br> });<br> <br> // Run the snippet initially on page load<br> $('.nx-page').one('pageload',function(){<br> skuid.snippet.getSnippet('EnableDisableGlobalSaveButton')();<br> });<br>})(skuid);
Inline Code for model event
var params = argumentsn0],<br>$ = skuid.$;<br>skuid.snippet.getSnippet('EnableDisableGlobalSaveButton')();
Enjoy!
Thanks Irvin, this worked for me after a small correction,
In here; on-load JS should be should be an In-line event in order to execute on-Load of the page and code for model event should be a snippet
In Banzai, page title buttons now have “Enable Rendering” as well as “Conditional Rendering” – javascript no longer needed!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.