Quantcast
Viewing all articles
Browse latest Browse all 40

Export Selected Rows of a Grid.

Hi everyone,

I'm new in Grails, and I'm developing an application which export a selected rows of a grid to excel. For this I am using Grails 2.2.0, Easygrid plugin 1.3.0, Export plugin 1.5, jQuery plugin 1.8.3 and jQuery-ui plugin 1.8.24.

I would like to add a column "Export" with a checkbox per row, but I don't know how to do it through plugins.

Actually, I have this:

GridToExport.jpg

My code for the grid and export is this:

Controller:

Code:

....
        static grids = {
       
        resumenGrid {

            dataSourceType 'gorm'
            domainClass Resumen

            columns {
                id {
                    type 'id'
                }
                item
                descripcion
                unidad
                exporta
            }
        }
    }

.....


View:

HTML Code:

<html>
<head>
    <meta name="layout" content="main">
    <title>Resumenes</title>
    <r:require modules="easygrid-jqgrid-dev,export"/>
    <nav:resources/>
</head>

<body id="resumen">
<div id="menu">
    <nav:render group="tabs"/>
</div>
<grid:grid name="resumenGrid" jqgrid.width='958' columns.id.jqgrid.formatter='customShowFormat'
          jqgrid.caption='"Resumenes"' addUrl="${g.createLink(controller: 'resumen',action: 'add')}"/>

<grid:exportButton name="resumenGrid"/>

</body>

<r:script>

        function customShowFormat(cellvalue, options, rowObject) {
            return "<a href='${g.createLink(controller: "resumen", action: "show")}/" + cellvalue + "'>" + cellvalue + "</a> ";
        }

</r:script>
<jq:jquery>
    console.log(jQuery('#resumenGrid_table').jqGridMethod('setSelection', 1));
</jq:jquery>
</html>



¿Can I add a checkbox in a grid (row/column) through plugins (Easygrid and Export) which represent a boolean attribute? ¿How to? Or ¿Can I export selected rows through "multiselect"? ¿How to?



Thank you for any help.
Attached Images

Viewing all articles
Browse latest Browse all 40

Trending Articles