Cuba Platform
Excel Support
Steps
As long as “Excel export” is a standard built-in action, you can add it
to the screen declaratively. Open the actions editor for the table, and
add an action with excel identifier:
- On the left side of Cuba Studio click on Generic UI
- Scroll down to your entity
- Select the xml associate with the view
Naming, the database table all lower case with underscores replaced by
hyphens followed by “-browse.xml”
This opens Screen Designer with the tabs * Properties * Layout
* Datasources * xml * controller
Where is this Actions Editor?
Under the XML tab
The xml file in this case is in
./modules/web/src/com/pds/pdssr/web/saleproductcustvw/sale-product-cust-vw-browse.xml
${PROJECT_ROOT}/modules/web/src/${PROJECT_PACKAGE}/web/saleproductcustvw/sale-product-cust-vw-browse.xml
After editting it looks like this
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<window xmlns="http://schemas.haulmont.com/cuba/window.xsd"
caption="msg://browseCaption"
class="com.pds.pdssr.web.saleproductcustvw.SaleProductCustVwBrowse"
focusComponent="saleProductCustVwsTable"
lookupComponent="saleProductCustVwsTable"
messagesPack="com.pds.pdssr.web.saleproductcustvw">
<dsContext>
<groupDatasource id="saleProductCustVwsDs"
class="com.pds.pdssr.entity.SaleProductCustVw"
view="_local">
<query>
<![CDATA[select e from pdssr$SaleProductCustVw e]]>
</query>
</groupDatasource>
</dsContext>
<dialogMode height="600"
width="800"/>
<layout expand="saleProductCustVwsTable"
spacing="true">
<filter id="filter"
applyTo="saleProductCustVwsTable"
datasource="saleProductCustVwsDs">
<properties include=".*"/>
</filter>
<groupTable id="saleProductCustVwsTable"
width="100%">
<actions>
<action id="create"/>
<action id="edit"/>
<action id="remove"/>
</actions>
<columns>
<column id="orgDistrib"/>
<column id="orgMfr"/>
<column id="product"/>
<column id="distributorCustomer"/>
<column id="invAmt"/>
<column id="caseEquivQty"/>
<column id="itemQty"/>
<column id="invDt"/>
<column id="productDescr"/>
</columns>
<rows datasource="saleProductCustVwsDs"/>
<rowsCount/>
<buttonsPanel id="buttonsPanel"
alwaysVisible="true">
<button id="createBtn"
action="saleProductCustVwsTable.create"/>
<button id="editBtn"
action="saleProductCustVwsTable.edit"/>
<button id="removeBtn"
action="saleProductCustVwsTable.remove"/>
<button action="saleProductCustVwsTable.excel"/>
</buttonsPanel>
</groupTable>
</layout>
</window>
Note the relevant entry is:
<button action="saleProductCustVwsTable.excel"/>}
The directory name is the database table name, all lower case with “_”
removed. The file name is the database table name with “_” replaced by
“-”
In Cuba Studio
- Build -> Assemble Project
- Run -> Restart Application Server
I now get the following error:
GuiDevelopmentException: Can't find action 'excel' in 'saleProductCustVwsTable'
Frame ID: pdssr$SaleProductCustVw.browse
XML descriptor: com/pds/pdssr/web/saleproductcustvw/sale-product-cust-vw-browse.xml
Holder ID: saleProductCustVwsTable
Questions
What is the actions editor for a table?
Google “cuba platform actions editor”
References
https://www.google.com/search?q=cuba+platform+actions+editor
https://doc.cuba-platform.com/manual-6.4/declarative_actions.html
Questions
What is the actions editor for a table?
What changes do I make to my code to support this xml change?