I am working in a Javascript plugin to extend the ELN-LIMS functionality. It consists in a button that launches a dialog. This is the code:
sampleFormTop: function($container, model) {
var $jsonHelper = FormUtil.getButtonWithText("JSON Helper", function() {
// Show the custom dialog
showCustomDialog();
}, '', null);
In this case, the button appears in the top-part of the Sample form (as it says in the documentation).
My question is: Is possible to recreate the same button but in the Experiment form? (Without touching the inner Javascript code, I know that this is possible, but I would prefer to avoid it, if this is the only way, I will modify it then).
And also, how can I move this button to the “More…” button in the toolbar at the top? So it will be an option in this view, instead of a lonely button in the top.
Thank you for your answers. I was testing both solutions, but without any success.
“experimentFormTop” works perfectly fine, thank you. The only problem is that there was no example file containing his feature (all the example plugins contain dataset and sample Form, but no the experiment field).
I am trying to place the button in the Toolbar following the example, but adapting it to the “experimentFormTop”, but I cannot make it work. This is how I have it now:
experimentFormTop: function($container, model) {
var extraToolbar = function(mode, experiment) {
var toolbarModel = [];
if (mode === FormMode.VIEW) {
var $demoButton = FormUtil.getButtonWithIcon("glyphicon-heart", function () {
showCustomDialog();
});
toolbarModel.push({ component: $demoButton, tooltip: "Demo" });
}
return toolbarModel;
};
$container.append(extraToolbar(FormMode.VIEW, experiment));
},
I do not receive any error, but just the title of the Experiment appears, and the rest is a white screen. How should this be done under the “experimentFormTop” or “sampleFormTop” to place the button in the Toolbar?