All Apps and Add-ons

How is CustomeBehavior module working model is?

lionel319
Explorer

why is My application.js doesn't seem to work as intended?

I had my application.js look like this

Sideview.utils.declareCustomBehavior("NullModule", function(module)  {
    module.onContextChange  = function()  {
        alert("Haha");
    }
});

And then I have my view xml look like this:-

<module name="Table">
    <module name="CustomeBehaviour">
        <param name="customBehaviour">NullModule</param>
    </module>
</module>

When I click at the table row data, it doesn’t pop up an alert box.
Am I missing something here?

1 Solution

sideview
SplunkTrust
SplunkTrust

There are a couple typos here. CustomBehaviour has the english spelling whereas I'm afraid the app uses the american spelling - CustomBehavior. Also you have an extra e in one of them.

Aside from that, if you only just created an application.js file, you'll have to restart splunkWeb for it to get picked up.

And a third possibility is simply that you have to clear your browser cache. SplunkWeb has a very aggressive cacheing policy for static files, and while there are mechanisms in place to ensure that app-upgrade and splunk-upgrade scenarios never actually experience browser-cache issues, for app-developers and splunk admins tinkering with these static files, you have to constantly be on the lookout for them.

Also, you probably know this but when you put a module downstream from a Table module, and you're not using Table Embedding, then it will only ever receive a "push" (in technical terms, onContextChange will only fire...) when the user clicks on one of the Table rows.

View solution in original post

sideview
SplunkTrust
SplunkTrust

There are a couple typos here. CustomBehaviour has the english spelling whereas I'm afraid the app uses the american spelling - CustomBehavior. Also you have an extra e in one of them.

Aside from that, if you only just created an application.js file, you'll have to restart splunkWeb for it to get picked up.

And a third possibility is simply that you have to clear your browser cache. SplunkWeb has a very aggressive cacheing policy for static files, and while there are mechanisms in place to ensure that app-upgrade and splunk-upgrade scenarios never actually experience browser-cache issues, for app-developers and splunk admins tinkering with these static files, you have to constantly be on the lookout for them.

Also, you probably know this but when you put a module downstream from a Table module, and you're not using Table Embedding, then it will only ever receive a "push" (in technical terms, onContextChange will only fire...) when the user clicks on one of the Table rows.

lionel319
Explorer

Ahhhh. Thank you so much. It works after i cleared my cache 🙂

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...