The export action for the grid panel allows the user to save the attributes displayed in the grid to a number of different formats.
The formats supported by this tool are all provided by separate plugins, with HTML, CSV and Excel being the currently supplied plugins.
More often than not the export actions are added to a menu that is itself included in the grid panel, rather than the button being directly embedded.
The HTML export supports an external .css file allowing for the HTML output to be prettied up a little.
This is accomplished by creating a file named 'export_html.css' saving it in the workspace directory, the content of this file will be embedded directly in the generated HTML document as a stylesheet.
The following is an example of a basic export_html.css file that will change the background colours for the table.
table { background-color: #beccdd; } tr.even { background-color: #ffffff; } tr.odd { background-color: #deecfd; }
ID
com.cohga.html.client.grid.exportAction
Properties
name | description |
---|---|
text | The label to display to the user. |
iconCls | The id of an icon to display for the export item. |
format | The format to export the data in, this must correspond to one of the supported formats based on the installed plugins, currently 'html', 'excel' or 'csv'. |
tooltip | This will change the tooltip display and should contain title and text properties. |
Examples
<item action="com.cohga.client.actions.menuAction"> <text>Export</text> <iconCls>icon-database_go</iconCls> <item action="com.cohga.html.client.grid.exportAction"> <text>CSV</text> <format>csv</format> <iconCls>icon-page_white_world</iconCls> <tooltip> <title>CSV</title> <text>Export the data to a comma separated text file</text> </tooltip> </item> <item action="com.cohga.html.client.grid.exportAction"> <text>Excel</text> <format>excel</format> <iconCls>icon-page_white_excel</iconCls> <tooltip> <title>Excel</title> <text>Export the data to an Microsoft Excel spreadsheet</text> </tooltip> </item> <item action="com.cohga.html.client.grid.exportAction"> <text>HTML</text> <format>html</format> <iconCls>icon-page_white_world</iconCls> <tooltip> <title>HTML</title> <text>Export the data to a HTML page</text> </tooltip> </item> </item>