Skip to content
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

can't use datatables #92

Closed
truongngoctuan opened this issue Jun 25, 2014 · 7 comments
Closed

can't use datatables #92

truongngoctuan opened this issue Jun 25, 2014 · 7 comments

Comments

@truongngoctuan
Copy link
Contributor

hi tudor-malene,

I follow your tutorial to create a new grid. Here is all the things I done but still can't load the datatables properly. Can you check which step is missing ?

my domain:

class PAProfile {
    String name
    static hasMany = [details: PACateCharDetails]

    static constraints = {
    }
}

controller:

@Easygrid
class PAProfileController {
    def PAProfilesGrid = {
        domainClass PAProfile
        gridImpl 'dataTables'
        columns {
            id
            name
        }
    }
......

in my layout:

<r:require modules="jquery, jquery-ui, easygrid-jqgrid-dev,  easygrid-datatables-dev, export"/>

in my gsp:

<grid:grid name="PAProfiles"/>

the result:
image

i saw in my console, there is always a line like this:

easygrid.EasygridDispatchService No service method for: callGridImplHtmlGridDefinition

What could be wrong ?? I am using grails 2.3.7

@tudor-malene
Copy link
Owner

The problem is that you added both resources modules: 'easygrid-jqgrid-dev' and 'easygrid-datatables-dev'.
Because your grid is rendered with datatables you should remove easygrid-jqgrid-dev.
This is because the javascript libraries are conflicting .

@truongngoctuan
Copy link
Contributor Author

Follow your advise, I removed it but it still the same. But I also do the same thing with the whole new project. It works.

So I am thinking about the conflict with other plugins, but checking dependency-report, only conflict related to easyGrid is about jquery or jquery_ui

The main reason is because this exception in the console:

easygrid.EasygridDispatchService No service method for: callGridImplHtmlGridDefinition

I stuck. Do you have any other ideas of what could happen ?

@truongngoctuan
Copy link
Contributor Author

I found apart of the problem!
Because jquery in my current project can't use $ directly (so I change fom $ ----> jquery.noConflict())

Now it can load datatables but always stop at processing data...
image

full stack error:

easygrid.EasygridDispatchService No service method for: callGridImplHtmlGridDefinition
util.GrailsUtil [DEPRECATED] Method ConfigurationHolder.getConfig() is deprecated and will be removed in a future version of Grails.
util.GrailsUtil [DEPRECATED] Method ConfigurationHolder.getConfig() is deprecated and will be removed in a future version of Grails.
errors.GrailsExceptionResolver IllegalArgumentException occurred when processing request: [GET] /FinAdmin/PAProfile/PAProfilesRows - parameters:
iSortCol_0: 0
bRegex: false
sSearch_0: 
sSearch: 
iSortingCols: 1
mDataProp_0: 0
bSearchable_0: true
sSortDir_0: asc
bSortable_0: true
iDisplayStart: 0
sColumns: name
iColumns: 1
_: 1403799403742
iDisplayLength: 10
sEcho: 1
bRegex_0: false
setAttribute: Non-serializable attribute searchParams_PAProfiles. Stacktrace follows:
java.lang.IllegalArgumentException: setAttribute: Non-serializable attribute searchParams_PAProfiles
    at org.grails.plugin.easygrid.GridUtils.storeLastSearch(GridUtils.groovy:171)
    at org.grails.plugin.easygrid.EasygridService.gridData(EasygridService.groovy:59)
    at org.grails.plugin.easygrid.EasygridInitService$_registerControllerMethods_closure4.doCall(EasygridInitService.groovy:74)
    at org.grails.plugin.easygrid.EasygridService.guard(EasygridService.groovy:216)
    at org.grails.plugin.easygrid.EasygridInitService$_registerControllerMethods_closure9_closure17.doCall(EasygridInitService.groovy:109)
    at grails.plugin.cache.web.filter.PageFragmentCachingFilter.doFilter(PageFragmentCachingFilter.java:191)
    at grails.plugin.cache.web.filter.AbstractFilter.doFilter(AbstractFilter.java:63)
    at org.apache.shiro.grails.SavedRequestFilter.doFilter(SavedRequestFilter.java:55)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
    at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
    at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
    at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
    at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:380)
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)

and then I try to comment line 171 in file src > groovy > org.grails.plugin.easygrid > GridUtils.groovy

//session.setAttribute("searchParams_${gridConfig.id}".toString(), params)

and it works, but I am not sure what could be the impact in future

I do some debugging in case you can't reproduce the error:
in function: static void storeLastSearch(gridConfig) {
gridConfig:
image
params: [iSortCol_0:0, bRegex:false, sSearch_0:, sSearch_1:, sSearch:, iSortingCols:1, mDataProp_0:0, mDataProp_1:1, bSortable_1:true, bSearchable_1:true, bSearchable_0:true, sSortDir_0:asc, bSortable_0:true, iDisplayStart:0, sColumns:id,name, iColumns:2, _:1403800353823, iDisplayLength:10, sEcho:1, bRegex_0:false, bRegex_1:false, action:PAProfilesRows, controller:PAProfile]

@tudor-malene
Copy link
Owner

This is really weird.
What kind of setup are you using?
What versions of java?

How do you run the application? With "run-app"?

@truongngoctuan
Copy link
Contributor Author

under linux mint 64bits, java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

and I am using IntelliJ IDEA to develop and can run with "grails run-app"

This is the company's project with ton of plugins and modules. So, my mission is to figure out what could be the problem when using your plugin :) (I tested it with a whole new project and it work pretty well in my computer)

@truongngoctuan
Copy link
Contributor Author

params at this time is the class org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap which is somehow can't serialize in my case. and the simple solution in this case is convert that params into something like HashMap which is always serializable.

        Map paramsMap = new HashMap()
        params.each { key, value -> paramsMap.put(key, value)}
        session.setAttribute("searchParams_${gridConfig.id}", paramsMap)

can I do a pull request update the code ?

@tudor-malene
Copy link
Owner

You can find these changes in 1.6.3

Thanks again for the contribtion.

Tudor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants