-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cascading jqgrids with initialCriteria specified #54
Comments
On a first glance the problem is here:
should be:
|
Thanks. Could you determine this from the error messages somehow or is it just something you know. How would a newbie like me figure this out on my own? |
Unfortunately, that was not the only issue. I still get the following (again, stacktrace truncated): | Error 2014-03-19 14:05:56,340 [http-bio-8443-exec-1] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [GET] /pasweb/customerAccess/brokerMailerJobsRows - parameters: | -1 | call in groovy.lang.Closure$call$2 |
So, a little more on this. Don't know if it is helpful. I stepped through your code and here is where it fails:
It dies on the filterCriteria(baseCriteria) call inside the filters.collect{ } statement. It is trying to combine the globalFilterClosure with the initialCriteria, as far as I can tell. For the fun of it, I removed the globalFilterClosure and the error went away. Of course, the tables weren't correct, but the error was gone. Maybe this will help determine what I am doing wrong? (PS. Sorry for posting so many times in a row...) |
Just in case it helps, here are the definitions of the domains in use. The definitions are: Customer - a customer (obviously) This interface is for the Broker to see the lists they've ordered by customer and job. They are responsible to make sure that the lists they've ordered arrive here on time. They log in, and we have stored their internal ID in the User.dbID field. We query the Mplists ordered by the brokers, then back to the Orders that contain those Mplists, then back to the Customers that placed those Orders. I am planning on displaying cascading tables. The first is the Customers that have Orders containing Mplists ordered by the Broker who has logged in. When they click on a Customer, the Orders that have Mplists ordered by the Broker get displayed. Finally, when they click on an Order, the Mplists will themselves display. Hopefully this makes some sense.
|
Not to belabor the point, but I put the following into a Service and it worked perfectly:
So, it appears something is wrong in the Easygrid code. Please let me know what else I can do to help you find the problem. |
This is indeed a bug in easygrid, which I fixed in the development version already. ( actually it's more of a weird behavior of gorm ) In order to fix it for you locally, until the next release, you can do the following.
( basically just remove baseCriteria ) |
Thanks! I will try it. Looking forward to that next release. :-)
|
Yes -- that fixed it. Now just looking forward to the DISTINCT option and I'm good to go! Thanks very much for your help (and for the plugin). |
You can fix the distinct issue locally by changing the last line of the 'list' method in GormDatasourceService to:
and by adding :
to your grid |
Suprisingly, it did not work: No signature of method: grails.gorm.DetachedCriteria.listDistinct() is Here is the code I entered (cut and pasted from the
Funny thing -- the documentation doesn't show a listDistinct method for Method Description There is a listDistinct on createCriteria. I also tried adding a ".unique" to the end of your statement when I haven't come up with a good solution yet. I've tried projections Any suggestions? Are we getting to the point where I have to create a On 03/20/2014 10:43 AM, Tudor Malene wrote:
Eric H. Raskin 914-765-0500 x120 |
Yes , you're right. Is your dataset very big? |
I think the jqGrid is saying about 24,000 rows. Are you suggesting that we Yes , you're right. Is your dataset very big? Reply to this email directly or view it on |
So I did a little more digging around. There is a "distinct" projection
generates the following SQL:
This is actually ALMOST correct. You can't do the count() at the same I have NO idea how to get around this fundamental flaw, unless you can
What do you think? |
Amazingly, after hours of web searching, I found a solution that works! Here is my initialCriteria:
Basically, I create a sub-query that returns distinct customer IDs. Then the outer query does an "in" clause against them, pulling all customers with IDs in the sub-query. This actually works! Of course, it is a bit inefficient, requiring two queries to get the results, but it is certainly better than nothing. |
Thanks for digging on this. Here are my thoughts:
I, personally incline more towards 1 ( if it is even possible) and 2 - if the performance is reasonable. |
Agreed. Option 2 works best for us. We don't have a very large On 03/21/2014 04:59 AM, Tudor Malene wrote:
Eric H. Raskin 914-765-0500 x120 |
This issue proved to be trickier than expected. I'll try to play with option 1 when I will get the chance. In you case, to improve performance, you can cache the distinct customer ids (and possible store the cache in the user session), or de-normalize the db a little, |
Hi Eric, please try easygrid 1.5.0 - when you get the chance. See this example: Thanks |
I am trying to output data using your Pet Clinic as an example. I will have three grids eventually, but for now I am just trying to cascade two grids. Note that both of my grids need to have initialCriteria (as I do not want to display all records in the database tables). Is this legal in the sub-grid?
My code contains:
Here are my view statements:
When I execute this, I get a 404 error on the screen:
and this in the log (truncated the stack trace):
| Error 2014-03-19 12:07:51,768 [http-bio-8443-exec-1] ERROR errors.GrailsExceptionResolver - MissingMethodException occurred when processing request: [GET] /pasweb/customerAccess/brokerMailerJobsRows - parameters:
sord: asc
page: 1
nd: 1395245271519
sidx:
format:
rows: 20
_search: false
No signature of method: pasweb.CustomerAccessController$_closure2_closure13.doCall() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap, grails.gorm.DetachedCriteria) values: [[sord:asc, page:1, nd:1395245271519, sidx:, ...], ...]
Possible solutions: doCall(java.lang.Object), call(), call([Ljava.lang.Object;), call(java.lang.Object), findAll(). Stacktrace follows:
Message: No signature of method: pasweb.CustomerAccessController$_closure2_closure13.doCall() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap, grails.gorm.DetachedCriteria) values: [[sord:asc, page:1, nd:1395245271519, sidx:, ...], ...]
Possible solutions: doCall(java.lang.Object), call(), call([Ljava.lang.Object;), call(java.lang.Object), findAll()
Line | Method
->> 55 | unwrap in org.codehaus.groovy.runtime.ScriptBytecodeAdapter
| -1 | call in groovy.lang.Closure$call$2
| 45 | defaultCall . . . . . . . . . . . . . in org.codehaus.groovy.runtime.callsite.CallSiteArray
| 108 | call in org.codehaus.groovy.runtime.callsite.AbstractCallSite
| 116 | call . . . . . . . . . . . . . . . . in ''
| 210 | doCall in org.grails.plugin.easygrid.datasource.GormDatasourceService$_createWhereQuery_closure8
| -2 | invoke0 . . . . . . . . . . . . . . . in sun.reflect.NativeMethodAccessorImpl
| 57 | invoke in ''
| 43 | invoke . . . . . . . . . . . . . . . in sun.reflect.DelegatingMethodAccessorImpl
| 606 | invoke in java.lang.reflect.Method
| 1254 | jlrMethodInvoke . . . . . . . . . . . in org.springsource.loaded.ri.ReflectiveInterceptor
| 90 | invoke in org.codehaus.groovy.reflection.CachedMethod
| 233 | doMethodInvoke . . . . . . . . . . . in groovy.lang.MetaMethod
| 1086 | invokeMethod in groovy.lang.MetaClassImpl
| 1110 | invokeMethod . . . . . . . . . . . . in groovy.lang.ExpandoMetaClass
| 910 | invokeMethod in groovy.lang.MetaClassImpl
| 411 | call . . . . . . . . . . . . . . . . in groovy.lang.Closure
The text was updated successfully, but these errors were encountered: