In a view I created a button to print the selected lines in pdf format (simulating the functionality of the excel button).
I followed FREE WEBINARS - REPORTING from 1:11:35 to 1:15:00 and it works perfectly.
DemoPDF.rar (9.2 MB)
<groupTable id="table"
multiselect="true"
width="100%">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
<action id="excel"/>
</actions>
<columns>
<column id="attr1"/>
<column id="attr2"/>
<column id="attr3"/>
<column id="attr4"/>
<column id="attr5"/>
</columns>
<rows datasource="entity1sDs"/>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn"
action="table.create"/>
<button id="editBtn"
action="table.edit"/>
<button id="removeBtn"
action="table.remove"/>
<button id="excelBtn"
action="table.excel"/>
<button id="pdfButton"
caption="Pdf"
icon="FILE_PDF_O"/>
</buttonsPanel>
</groupTable>
controller
import com.company.demopdf.entity.Entity1;
import com.haulmont.cuba.gui.components.Button;
import com.haulmont.cuba.gui.components.EntityCombinedScreen;
import com.haulmont.cuba.gui.components.Table;
import com.haulmont.reports.gui.actions.TablePrintFormAction;
import javax.inject.Inject;
import java.util.Map;
public class Entity1Browse extends EntityCombinedScreen {
@Inject
private Button pdfButton;
@Inject
private Table<Entity1> table;
@Override
public void init(Map<String, Object> params) {
super.init(params);
pdfButton.setAction(new TablePrintFormAction(table));
}
}
I select 2 of 3 for example
I press pdf button
and report pdf appear
I have a problem, the example above use groupTable, how can I do the same implementation if I have a dataGrid?
There is not “DataGridPrintFormAction()” method