Is there a correct syntax to mimic the action.setParams({ serverParam: someValue }
but for clientside methods?
Let's say I have the following:
component.find("myComp").fireMethod(
"param1",
"param2",
"param3"
);
The current workaround I have if I don't need param2
is to declare it to null. Passing in params by explicitly stating them against an attribute like the below syntax from the docs doesn't work.
component.find('overlayLib').showCustomModal({
header: "Application Confirmation",
body: modalBody,
showCloseButton: true,
cssClass: "mymodal",
closeCallback: function() {
alert('You closed the alert!');
}
})
This was grabbed from the https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/ref_lightning_overlayLibrary.htm documentation.
My end goal is to do this:
component.find("myComp").fireMethod(
param1: "param1",
param3: "param3"
);
Not this, which is the current workaround for custom component methods:
component.find("myComp").fireMethod(
param1: "param1",
param2: null,
param3: "param3"
);
What am I missing? It would be nice to have a single custom component method defined and then only pass in the necessary parameters instead of passing in null
a bunch of times for optional vars.