Hello CUBA team,
This is driving me crazy. I’ve got a service which I created because it needs to parse data in the same fashion on both the Browse and Edit screens (my client wants the same functionality on both screens). The problem I’m currently facing is that I can’t get the action set up correctly on the Edit screen. Since I can’t find a nice way to set up the action on the Edit screen, I’ve been following this.
Quick background information:
The service takes the class data container, creates an HTML string and then sends back a byte[] array. I’m sending this back as a return value because the ExportDisplay option doesn’t seem to be available in the service.
The problem I’m facing is that I’m not sure how to call the service from a button in the Edit controller. I keep getting syntax errors.
@Subscribe
public void onInit(InitEvent event) {
printSummaryBtn.setAction(new BaseAction("Print Summary") {
String jobNameAndNumber = jobDc.getItem().getJobName() + "_" + jobDc.getItem().getJobNumber();
@Override
public void actionPerform(Component component) {
byte[] bytes = printJobService.printSummary(Job jobDc);
exportDisplay.show(new ByteArrayDataProvider(bytes), jobNameAndNumber + ".html", ExportFormat.HTML);
}
});
}
I’m sure I’ve misinterpreted the help files, but I would really appreciate some guidance. It’s entirely possible that I’m going about this all wrong. This is just the way that I’ve been lead to by the documentation I could find.
Thanks