tudor-malene / Easygrid

Grails plugin - simple and declarative way of defining a DataGrid
Apache License 2.0
27 stars 24 forks source link

Upgrade from 1.6.6 to 1.7.1 and grid stopped working #146

Open ericraskin opened 9 years ago

ericraskin commented 9 years ago

Hi:

I've upgraded my project from 1.6.6 to 1.7.1 (refresh-dependencies, clean, easygrid-setup, compile). When I now execute my project, any page with a grid comes up "crosshatched out" in Firefox and Chrome. I also see "Warning: Please select row" in dialog boxes at the end of the render. Of course, it all worked fine before the upgrade.

I do see the grids rendering properly and loading with data.

Note that my pages have master/child grids. It is behaving like the child grids are trying to load before any rows have been selected in the master grids.

What might have changed that could cause this?

Example code:

       <div class="row">
          <div class="col-md-10">
            <p>Click on a List to view the rental orders</p>
            <grid:grid name="managerList">
                <grid:set altRows="true"/>
                <grid:set width="auto" height="auto" caption="Lists" />
                <grid:set col="counts" label="Counts" align="center" formatter="f:countsViewButton" />
            </grid:grid>
          </div>
      </div>
      <br/>
      <div class="row">
        <div class="col-md-10">
          <p>Click on the first column next to the PAS number to view the order details</p> 
          <grid:grid name="managerListOrders" masterGrid="managerList" childParamName="listId">
              <grid:set altRows="true"/>
              <grid:set width="auto" height="auto" caption="Rental Orders"/>
          </grid:grid>
          <grid:exportButton name="managerListOrders" formats="['excel','csv','pdf']"/>
        </div>
      </div>
    def managerListGrid = {
        dataSourceType 'gorm'
        domainClass RentalList
        initialCriteria {
            def user = springSecurityService.currentUser
            manager {
                eq ('id', user.customerid)
            }
//          order("title")
        }
        enableFilter true
        inlineEdit false
        jqgrid {
            rowNum 10
            sortname 'title'
            sortorder 'asc'
        }
        columns {
            id {
                jqgrid {
                    hidden true
                }
            }
            title {
                label "List"
                jqgrid {
                    width "400"
                }
            }
            counts {
                value {
                    def urlStr = "https://www.paslists.com/counts/" + URLEncoder.encode(it.lst_table,"UTF-8") + ".xlsx"
                    def http = new HTTPBuilder(urlStr)
                    def lst_table = it.lst_table
                    def retval
                    http.request(HEAD) {
                        response.success = { resp ->
                            retval = lst_table + ".xlsx"
                        }
                        response.failure = { resp ->
                            retval = -1
                        }
                    }
                    if (retval == -1) {
                        urlStr = "https://www.paslists.com/counts/" + URLEncoder.encode(it.lst_table,"UTF-8") + ".pdf"
                        http = new HTTPBuilder(urlStr)
                        http.request(HEAD) {
                            response.success = { resp ->
                                retval = lst_table + ".pdf"
                            }
                            response.failure = { resp ->
                                retval = -1
                            }
                        }
                    }
                    retval
                }
                enableFilter false
                jqgrid {
                    width "100"
                    align "center"
                }
                export {
                    hidden true
                }
            }
        }
    }

    def managerListOrdersGrid = {
        dataSourceType 'gorm'
        domainClass PASOrder
        idColName 'ordnum'
        subGrid 'managerListOrderDetails'
        globalFilterClosure { params ->
            rentalList {
                eq('id', params.listId ? params.listId as long: -1l)
            }
        }
        initialCriteria {
            eq('ord_type','LRO')
            eq('cancelled','1')
        }
        jqgrid {
            sortname 'orddate'
            sortorder 'desc'
            rowNum 50
        }
        enableFilter true
        inlineEdit false
        columns {
            ordnum {
                type 'id'
                property 'ordnum'
                label "PAS Num"
                jqgrid {
                    width "75"
                    align "center"
                }
            }
            mgrnum {
                label "Mgr Num"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            bkrnum {
                label "Broker PO"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            mailer {
                label "Mailer"
                value { it.rentalMailer.company }
                sortProperty "rentalMailer.company"
                filterProperty "rentalMailer.company"
                jqgrid {
                    width "175"
                }
            }
            orddate {
                label "Order Date"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            maildate {
                label "Mail Date"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            wantdate {
                label "Want Date"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            shipdate {
                label "Ship Date"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            statusDesc {
                label "Status"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
            decoy {
                label "Decoy String"
                jqgrid {
                    width "100"
                    align "center"
                }
            }
        }
    }
ericraskin commented 9 years ago

Tried a "clean-all" instead of "clean". Unfortunately, that did not help either.

tudor-malene commented 9 years ago

Hi, It could be the assets pipeline plugin.

ericraskin commented 9 years ago

Is there a particular version I need? I have asset-pipeline:1.9.9

On 04/06/2015 02:49 PM, Tudor Malene wrote:

Hi, It could be the assets pipeline plugin.

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90195016.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

tudor-malene commented 9 years ago

Umm, try a newer one. For ex 2.1.5

ericraskin commented 9 years ago

Will do. Thanks.

On 04/06/2015 02:53 PM, Tudor Malene wrote:

Umm, try a newer one. For ex 2.1.5

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90196522.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

ericraskin commented 9 years ago

Unfortunately, that did not fix it.

On 04/06/2015 02:53 PM, Tudor Malene wrote:

Umm, try a newer one. For ex 2.1.5

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90196522.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

ericraskin commented 9 years ago

I had to add a dependency to get a production war file to build after upgrading to asset-pipeline:2.1.5:

dependencies {
      ...
      compile 'com.google.guava:guava:18.0'  // required for asset pipeline
      ...
}

Then another refresh-dependencies, clean-all, compile. Unfortunately, that did not fix it either. :-(

On 04/06/2015 02:53 PM, Tudor Malene wrote:

Umm, try a newer one. For ex 2.1.5

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90196522.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

tudor-malene commented 9 years ago

You could try to compare the html of the page rendered with 1.6.6 and with 1.7.1 Maybe we spot something.

ericraskin commented 9 years ago

Good idea. Trouble is I can't find any difference. Any ideas on how to do this comparison, other than manually on the Firefox Inspector screen? The pages are buried pretty deep in my application, behind Spring Security logins. It's hard to just do a wget or a curl. :-/

On 04/06/2015 03:33 PM, Tudor Malene wrote:

You could try to compare the html of the page rendered with 1.6.6 and with 1.7.1 Maybe we spot something.

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90207834.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

ericraskin commented 9 years ago

Question: How does Easygrid know when to render a child grid? That seems to be the problem here. It seems to be trying to jump to rendering the child grid before a master row is chosen.

On 04/06/2015 03:33 PM, Tudor Malene wrote:

You could try to compare the html of the page rendered with 1.6.6 and with 1.7.1 Maybe we spot something.

— Reply to this email directly or view it on GitHub https://github.com/tudor-malene/Easygrid/issues/146#issuecomment-90207834.


Eric H. Raskin 914-765-0500 x120 Professional Advertising Systems Inc. 914-765-0503 fax 200 Business Park Dr Suite 304 eraskin@paslists.com Armonk, NY 10504 http://www.paslists.com

ericraskin commented 9 years ago

Hmmm... There is something that seems different upon closer inspection. On 1.7.1 Easygrid, I am seeing "::before" and "::after" in the Web Console. I don't see those things on 1.6.6. What are they?

ericraskin commented 9 years ago

Version 1.7.1:

image

Version 1.6.6: image

Note the ::before and ::after tags in the 1.7.1 version. Where are they coming from?

ericraskin commented 9 years ago

So I dumbed down one of my pages to a single grid and it still displays incorrectly. I get a Warning box with "Please, select row" at the bottom of the page and the page is grayed out:

image

You can just make out the cross-hatching in the screen shot. That should not be there.

Any idea where I can look now? The GSP contains:

<html>
<head>
    <meta charset="utf-8">
    <meta name="layout" content="main"
    <title>Professional Advertising Systems Inc.</title>
</head>
   <div class="row">
      <div class="col-md-6">
        <p>Click on a Mailer to view their merge jobs</p>
          <grid:grid name="brokerMailers" >
              <grid:set altRows="true"/>
              <grid:set width="500" height="auto" caption="Mailers" />
              <grid:set col="id" hidden="f:true" />
              <grid:set col="company" width="250" label="Mailer"/>
          </grid:grid>
      </div>
  </div>
</html>

I have tried commenting out portions of this, but I still get the same issue.

Could the problem have something to do with jquery or jquery-ui versions? My bootstrap-enabled website loads the latest versions from code.jquery.com. Is there any way to stop your plugin from loading them as well -- if you think that could be the problem?

ericraskin commented 9 years ago

Well, I've found the problem. For some reason, the jqgrid CSS files are not being pulled in by the asset-pipeline. When I load them directly from a CDN, everything works perfectly again.

I don't know enough about how asset-pipeline works with plugins to help you, but this is what you have in easygrid.jqgrid.css:

/*
*= require /jquery-ui/jquery-ui.css
*= require /jquery-ui/jquery-ui.theme.css
*= require /jqGrid/ui.jqgrid.css
*/

I'll bet it's the capital "G" in jqGrid. The directory entry in your plugin is assets/stylesheets/jqgrid (not jqGrid).