I'm trying out making two analyses available within a module, and I see that I need to update the javascript file manually in order to make the second analysis work, but I don't see any explicit examples of what that would look like... the examples below from the tutorial make me feel like I'm missing a step! Partly because I'm not sure what I need to tell it to do!!
module.exports = {
// event handlers and functions are defined here
// this is an example of an event handler
view_loaded: function(ui, event) {
// do something
},
// this is another example of an event handler
ttestType_changed: function(ui, event) {
let value = this.calculateValue();
// do something
},
// this is an example of an auxiliary function
calculateValue: function() {
// do something
}
};
I'm just feeling my way around and would appreciate some guidance
Assigning an updated event handler to a supplier control
-
- Posts: 4
- Joined: Mon Jul 18, 2022 11:26 pm
Re: Assigning an updated event handler to a supplier control
let me attend damo to this.
cheers
cheers
Re: Assigning an updated event handler to a supplier control
Hi, so what is it that you are trying to do that requires you to add javascript? Sometimes its easier to work through the exact problem to understand where you are getting stuck. I see the subject refers to wanting to assign an update event handler to a supplier. In the tutorial under the title 'Events' it describes how to add an event handler to a specific control event. So for a supplier control named bob the event handler for the 'updated' event would look like:
When compiled, the compiler will attach this function to the event 'updated' of the control 'bob'.
Code: Select all
bob_updated: function(ui, event) {
let value = ui.bob.value();
// do something in response to the event
}
-
- Posts: 4
- Joined: Mon Jul 18, 2022 11:26 pm
Re: Assigning an updated event handler to a supplier control
Hi! Thanks for your reply!
Ultimately when I build my module, I would like to have two analyses (and their within-analysis options) available to the user, so I am trying things out by extending on the tutorial at the moment in order to practice with simple(ish) things.
I successfully built the ttest from the tutorial, and am trying to add another analysis option to my module, I thought I would start by adding a simple linear regression and a plot. When I try to run the regression analysis I get the errors telling me I need to add an event handler. Of course all this may be entirely the wrong way to go about things!
It seems to me that what I'm trying to do is link up the correct analysis with that option on the UI. I also am not sure whether I should be making this change in the file associated with the first analysis or the new one that I've added.
I hope this makes sense! Thanks for taking the time to help a novice!
Cheers,
Rebecca
Ultimately when I build my module, I would like to have two analyses (and their within-analysis options) available to the user, so I am trying things out by extending on the tutorial at the moment in order to practice with simple(ish) things.
I successfully built the ttest from the tutorial, and am trying to add another analysis option to my module, I thought I would start by adding a simple linear regression and a plot. When I try to run the regression analysis I get the errors telling me I need to add an event handler. Of course all this may be entirely the wrong way to go about things!
It seems to me that what I'm trying to do is link up the correct analysis with that option on the UI. I also am not sure whether I should be making this change in the file associated with the first analysis or the new one that I've added.
I hope this makes sense! Thanks for taking the time to help a novice!
Cheers,
Rebecca
Re: Assigning an updated event handler to a supplier control
could you provide a screenshot of this?When I try to run the regression analysis I get the errors telling me I need to add an event handler.
with thanks
Re: Assigning an updated event handler to a supplier control
Ok, i think i may understand what is happening. So there are two supplier controls. 'Supplier' which is a generic supplier of anything. There is also a 'VariableSupplier' which has a back-end to handle all variable populating and updating. If you are using the 'Supplier' then it needs the event handler attached so that it can be manually populated/updated with content. The 'VariableSupplier' does this all automatically, unless you set the 'populate: manual', which will cause this error to be thrown as well. Hope that helps.
Re: Assigning an updated event handler to a supplier control
Information regarding the finer details of suppliers is not yet in the tutorials and explains how you couldn't figure it out.
-
- Posts: 4
- Joined: Mon Jul 18, 2022 11:26 pm
Re: Assigning an updated event handler to a supplier control
Here you go!jonathon wrote:could you provide a screenshot of this?When I try to run the regression analysis I get the errors telling me I need to add an event handler.
with thanks
-
- Posts: 4
- Joined: Mon Jul 18, 2022 11:26 pm
Re: Assigning an updated event handler to a supplier control
Yes, I think this is right, and as you say below, there's no information added yet on how to do it. I've never tried to do something like this before, so don't have any experience to fall back on to figure it out!dropmann wrote:Ok, i think i may understand what is happening. So there are two supplier controls. 'Supplier' which is a generic supplier of anything. There is also a 'VariableSupplier' which has a back-end to handle all variable populating and updating. If you are using the 'Supplier' then it needs the event handler attached so that it can be manually populated/updated with content. The 'VariableSupplier' does this all automatically, unless you set the 'populate: manual', which will cause this error to be thrown as well. Hope that helps.