Could any of you either point me in the right direction or describe exactly what happens when a grid's column header is clicked? I'll give the specifics of my situation:
I am using a Gird<BeanModel> that uses an RpcProxy<PagingLoadResult> to load the data into the Grid's store. I have a class that extends BaseListLoadConfig and implements PagingLoadConfig because I need to pass some parameters to my search service. Of course, this works great when my code initiates the search, since I can populate my custom object, but the problem (ClassCastException) occurs when I click a column header to perform a sort of the data. I assume that is because this event is creating an object of the type BasePagingLoadConfig (according to Firebug). If the results in this grid are the results of a user-specified search, including customized search parameters, I don't exactly know how the functionality of clicking a column header should work.
Any ideas or suggestions are welcome, and thanks in advance.
00:00:37.187 [ERROR] Uncaught exception escaped
<pre>java.lang.ClassCastException: com.extjs.gxt.ui.client.data.BasePagingLoadConfig cannot be cast to org.myapp.web.client.controller.FacetSearchPagingLoadConfig
at org.myapp.web.client.entrypoint.MyApp$3.load(MyApp.java:206)
at com.extjs.gxt.ui.client.data.RpcProxy.load(RpcProxy.java:21)
at com.extjs.gxt.ui.client.data.BaseLoader.loadData(BaseLoader.java:134)
at com.extjs.gxt.ui.client.data.BaseLoader.load(BaseLoader.java:98)
at com.extjs.gxt.ui.client.data.BaseLoader.load(BaseLoader.java:92)
at com.extjs.gxt.ui.client.store.ListStore.sort(ListStore.java:378)
at com.extjs.gxt.ui.client.widget.grid.GridView.doSort(GridView.java:955)
at com.extjs.gxt.ui.client.widget.grid.GridView.onHeaderClick(GridView.java:1522)
at com.extjs.gxt.ui.client.widget.grid.GridView$8.onHeaderClick(GridView.java:1401)
at com.extjs.gxt.ui.client.widget.grid.ColumnHeader$Head.onClick(ColumnHeader.java:289)
at com.extjs.gxt.ui.client.widget.grid.ColumnHeader$Head.onComponentEvent(ColumnHeader.java:264)
at com.extjs.gxt.ui.client.widget.Component.onBrowserEvent(Component.java:876)
at com.google.gwt.user.client.DOM.dispatchEventImpl(DOM.java:1307)
at com.google.gwt.user.client.DOM.dispatchEvent(DOM.java:1263)
at sun.reflect.GeneratedMethodAccessor31.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannel.reactToMessagesWhileWaitingForReturn(BrowserChannel.java:1713)
at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:165)
at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:120)
at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:507)
at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:264)
at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:188)
at sun.reflect.GeneratedMethodAccessor28.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:157)
at com.google.gwt.dev.shell.BrowserChannel.reactToMessages(BrowserChannel.java:1668)
at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:401)
at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:222)
at java.lang.Thread.run(Thread.java:619)</pre>
The listloader creates a loadconfig, because it did not get one. two solutions.
Extend BasePagingListLoader and override newLoadConfig to return your loadconfig or, fix your rpcproxy.load method, because the exception is in your code. You are casting without checking it.
It might be my design that is flawed, so I could definitely accept that. Is there another way (some kind of best-practice) to pass custom parameters to your search service if not in the LoadConfig object?