Hi, The problem is in EditableGrid. When you click on "Save" button it executes org.wicketstuff.egrid.column.EditableGridActionsPanel#newEditLink -> onClick(). Here it does: send(getPage(), Broadcast.BREADTH, rowItem);
As you can see this broadcasts the event to the whole page instead of just the grid instance. Because of that both grid instances in the page receive this event and try to use rowItem's (the payload) model. It works as desired for one of the grids but fails for the other. Martin Grigorov Wicket Training and Consulting https://twitter.com/mtgrigorov On Wed, Feb 24, 2016 at 3:42 PM, Martin Grigorov <mgrigo...@apache.org> wrote: > No sorry! > I didn't had a chance yet. > > Martin Grigorov > Wicket Training and Consulting > https://twitter.com/mtgrigorov > > On Wed, Feb 24, 2016 at 3:39 PM, Mihir Chhaya <mihir.chh...@gmail.com> > wrote: > >> Martin, >> >> Just wanted to check if you got chance to look at the GitHub code and if >> it >> is enough or any additional information is needed? >> >> Thanks, >> -Mihir. >> >> On Mon, Feb 22, 2016 at 10:26 AM, Mihir Chhaya <mihir.chh...@gmail.com> >> wrote: >> >> > Sure thing; I have put the code online at >> > https://github.com/mihirchhaya/egrid71 >> > >> > Thanks, >> > -Mihir. >> > >> > On Sat, Feb 20, 2016 at 6:50 AM, Martin Grigorov <mgrigo...@apache.org> >> > wrote: >> > >> >> Hi, >> >> >> >> Please share the mini application somewhere, e.g. GitHub. >> >> >> >> Martin Grigorov >> >> Wicket Training and Consulting >> >> https://twitter.com/mtgrigorov >> >> >> >> On Fri, Feb 19, 2016 at 7:30 PM, Mihir Chhaya <mihir.chh...@gmail.com> >> >> wrote: >> >> >> >> > Ok, so creating a small project with two panels(Person and Customer) >> >> and a >> >> > page for similar use case resulted in following stacktrace. >> >> > The panels are added in the order of PersonPanel, CustomerPanel in >> the >> >> > parent page. >> >> > >> >> > The line# 163 in onSave method of EditableGrid is calling >> >> > EditableGrid.this.onSave(target, rowModel); I wonder if the >> reference to >> >> > this is referring to the first EditableGrid with Person records. >> >> Switching >> >> > the order of adding grid panels throws the error other way around; >> >> > complaining for Person cannot be cast to Customer. >> >> > >> >> > *java.lang.ClassCastException: spikes.domain.Customer cannot be cast >> >> > to spikes.domain.Person* >> >> > at spikes.view.PersonPanel$1.onSave(PersonPanel.java:68) >> >> > at >> >> org.wicketstuff.egrid.EditableGrid$3.onSave(EditableGrid.java:163) >> >> > at >> >> > >> >> >> org.wicketstuff.egrid.column.EditableGridActionsColumn$1.onSave(EditableGridActionsColumn.java:34) >> >> > at >> >> > >> >> >> org.wicketstuff.egrid.column.EditableGridActionsPanel$2.onSuccess(EditableGridActionsPanel.java:71) >> >> > at >> >> > >> >> >> org.wicketstuff.egrid.component.EditableGridSubmitLink.onSubmit(EditableGridSubmitLink.java:37) >> >> > at >> >> > >> >> >> org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1.onSubmit(AjaxSubmitLink.java:110) >> >> > at >> >> > >> >> >> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior$AjaxFormSubmitter.onSubmit(AjaxFormSubmitBehavior.java:215) >> >> > at >> >> > >> org.apache.wicket.markup.html.form.Form.delegateSubmit(Form.java:1307) >> >> > at >> >> > >> >> >> org.wicketstuff.egrid.EditableGrid$NonValidatingForm.process(EditableGrid.java:79) >> >> > at >> >> > >> org.apache.wicket.markup.html.form.Form.onFormSubmitted(Form.java:795) >> >> > at >> >> > >> >> >> org.apache.wicket.ajax.form.AjaxFormSubmitBehavior.onEvent(AjaxFormSubmitBehavior.java:171) >> >> > at >> >> > >> >> >> org.apache.wicket.ajax.AjaxEventBehavior.respond(AjaxEventBehavior.java:155) >> >> > at >> >> > >> >> >> org.apache.wicket.ajax.AbstractDefaultAjaxBehavior.onRequest(AbstractDefaultAjaxBehavior.java:588) >> >> > at java.lang.reflect.Method.invoke(Method.java:606) >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) >> >> > at >> >> > >> >> >> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) >> >> > at >> >> > >> >> >> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) >> >> > at >> >> > >> >> >> org.apache.wicket.protocol.http.WicketFilter.processRequest(WicketFilter.java:203) >> >> > at >> >> > >> >> >> org.apache.wicket.protocol.http.WicketFilter.doFilter(WicketFilter.java:284) >> >> > at >> >> > >> >> >> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243) >> >> > at >> >> > >> >> >> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) >> >> > at >> >> > >> >> >> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222) >> >> > at >> >> > >> >> >> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123) >> >> > at >> >> > >> >> >> org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472) >> >> > at >> >> > >> >> >> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171) >> >> > at >> >> > >> >> >> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99) >> >> > at >> >> > >> >> >> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:936) >> >> > at >> >> > >> >> >> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) >> >> > at >> >> > >> >> >> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407) >> >> > at >> >> > >> >> >> org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1004) >> >> > at >> >> > >> >> >> org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589) >> >> > at >> >> > >> >> >> org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312) >> >> > 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:744) >> >> > >> >> > Complete stack: >> >> > >> >> > org.apache.wicket.WicketRuntimeException: Method onRequest of >> >> > interface org.apache.wicket.behavior.IBehaviorListener targeted at >> >> > org.apache.wicket.ajax.markup.html.form.AjaxSubmitLink$1@47743d65 on >> >> > component [EditableGridSubmitLink [Component id = save]] threw an >> >> > exception >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:268) >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) >> >> > at >> >> > >> >> >> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) >> >> > at >> >> > >> >> >> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) >> >> > >> >> > java.lang.reflect.InvocationTargetException >> >> > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >> >> > at >> >> > >> >> >> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) >> >> > at java.lang.reflect.Method.invoke(Method.java:606) >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.internalInvoke(RequestListenerInterface.java:258) >> >> > at >> >> > >> >> >> org.apache.wicket.RequestListenerInterface.invoke(RequestListenerInterface.java:241) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.invokeListener(ListenerInterfaceRequestHandler.java:248) >> >> > at >> >> > >> >> >> org.apache.wicket.core.request.handler.ListenerInterfaceRequestHandler.respond(ListenerInterfaceRequestHandler.java:234) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle$HandlerExecutor.respond(RequestCycle.java:865) >> >> > at >> >> > >> >> >> org.apache.wicket.request.RequestHandlerStack.execute(RequestHandlerStack.java:64) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.execute(RequestCycle.java:265) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequest(RequestCycle.java:222) >> >> > at >> >> > >> >> >> org.apache.wicket.request.cycle.RequestCycle.processRequestAndDetach(RequestCycle.java:293) >> >> > at >> >> > >> >> >> org.apache.wicket.protocol.http.WicketFilter.processRequestCycle(WicketFilter.java:261) >> >> > >> >> > >> >> > On Fri, Feb 19, 2016 at 12:15 PM, Mihir Chhaya < >> mihir.chh...@gmail.com> >> >> > wrote: >> >> > >> >> > > Just realized that last two lines could be confusing: the >> >> decisionCode is >> >> > > the property of class PcaCodes in pcapanel, but showing up for >> >> > exccodepanel >> >> > > row item. >> >> > > >> >> > > On Fri, Feb 19, 2016 at 12:06 PM, Mihir Chhaya < >> >> mihir.chh...@gmail.com> >> >> > > wrote: >> >> > > >> >> > >> My mistake about the inmethod grid dependency. I don't know why I >> saw >> >> > >> compilation error in editable grid class when removed inmethod >> grid >> >> jar >> >> > >> from classpath. >> >> > >> >> >> > >> For debugging the respond method as your suggestion, I do see >> correct >> >> > >> class types for each rowItem (as attachment). But it fails with >> >> > following >> >> > >> error: >> >> > >> >> >> > >> Last cause: No get method defined for class: class >> >> > >> packagename.ExceptionalDocCode expression: decisionCode >> >> > >> WicketMessage: Exception in rendering component: >> >> > >> [EditableTextFieldCellPanel [Component id = cell]] >> >> > >> >> >> > >> >> >> > >> On Thu, Feb 18, 2016 at 5:06 PM, Martin Grigorov < >> >> mgrigo...@apache.org> >> >> > >> wrote: >> >> > >> >> >> > >>> On Thu, Feb 18, 2016 at 10:53 PM, Mihir Chhaya < >> >> mihir.chh...@gmail.com >> >> > > >> >> > >>> wrote: >> >> > >>> >> >> > >>> > Thanks, Martin. >> >> > >>> > >> >> > >>> > By writing dependency on wicket in-method grid I meant editable >> >> grid >> >> > >>> > inherently referring inmethod grid. >> >> > >>> > >> >> > >>> >> >> > >>> >> >> > >>> >> >> > >> >> >> https://github.com/wicketstuff/core/blob/master/editable-grid-parent/editable-grid/pom.xml >> >> > >>> >> >> > >>> >> >> > >> >> >> https://github.com/wicketstuff/core/blob/master/editable-grid-parent/pom.xml >> >> > >>> The only dependency is wicket-extensions. >> >> > >>> I am not sure what you mean by "inherently referring". >> >> > >>> >> >> > >>> >> >> > >>> > >> >> > >>> > I did check the Ajax url earlier and following are the values >> in >> >> > >>> rendered >> >> > >>> > html page for the panel. >> >> > >>> > >> >> > >>> > >> >> > >>> > >> >> > >>> >> >> > >> >> >> Wicket.Ajax.ajax({"u":"./appcontext?5-2.IBehaviorListener.0-admincontroltabs-panel-pcapanel-pcacodegridForm-pcaDataTable-form-dataTable-body-rows-16-cells-6-cell-edit","c":"edit104","e":"click"});; >> >> > >>> > >> >> > >>> > >> >> > >>> > >> >> > >>> >> >> > >> >> >> Wicket.Ajax.ajax({"u":"./appcontext?5-2.IBehaviorListener.0-admincontroltabs-panel-exccodepanel-excdoccodegridForm-excDataTable-form-dataTable-body-rows-10-cells-4-cell-edit","c":"edit113","e":"click"});; >> >> > >>> > >> >> > >>> >> >> > >>> Assuming that 'pcapanel' is 'aPanel' and 'exccodepanel' is >> 'bPanel' >> >> > >>> everything looks OK. >> >> > >>> Clicking on any of those cells should correctly find the >> respective >> >> > grid >> >> > >>> cell and execute its Ajax behavior. >> >> > >>> Put a breakpoint in AjaxEventBehavior#respond() and see why it >> finds >> >> > >>> ClassB. >> >> > >>> >> >> > >>> >> >> > >>> > >> >> > >>> > Thanks, >> >> > >>> > -Mihir. >> >> > >>> > >> >> > >>> > On Thu, Feb 18, 2016 at 3:18 PM, Martin Grigorov < >> >> > mgrigo...@apache.org >> >> > >>> > >> >> > >>> > wrote: >> >> > >>> > >> >> > >>> > > Hi, >> >> > >>> > > >> >> > >>> > > On Wed, Feb 17, 2016 at 5:09 PM, Mihir Chhaya < >> >> > >>> mihir.chh...@gmail.com> >> >> > >>> > > wrote: >> >> > >>> > > >> >> > >>> > > > Hello, >> >> > >>> > > > >> >> > >>> > > > My apologies if this is not the right place to post >> >> wicketstuff >> >> > >>> related >> >> > >>> > > > issues. If so, then please advice me with right forum/link. >> >> > >>> > > > >> >> > >>> > > >> >> > >>> > > This is the right forum! >> >> > >>> > > >> >> > >>> > > >> >> > >>> > > > >> >> > >>> > > > I am using Wicketstuff-editable-grid-7.1.0 (with >> dependency on >> >> > >>> > > > wicketstuff-inmethod-grid-7.1.0). >> >> > >>> > > > >> >> > >>> > > >> >> > >>> > > Why InMethod-Grid is needed? Or you are migrating from >> Inmethod >> >> to >> >> > >>> > Editable >> >> > >>> > > ? >> >> > >>> > > >> >> > >>> > > >> >> > >>> > > > >> >> > >>> > > > *Problem:* >> >> > >>> > > > When two editable grids from two separate child panels are >> >> > rendered >> >> > >>> > into >> >> > >>> > > > single container (parent panel), then clicking 'Edit' link >> in >> >> the >> >> > >>> row >> >> > >>> > for >> >> > >>> > > > ClassA related editable grid throws 'No get method defined >> for >> >> > the >> >> > >>> > class' >> >> > >>> > > > error for ClassB property which is related to another >> editable >> >> > >>> grid. >> >> > >>> > > > >> >> > >>> > > >> >> > >>> > > Check what is the url for the Ajax call that is made. >> >> > >>> > > This should tell you why it finds ClassB instead of ClassA. >> >> > >>> > > >> >> > >>> > > >> >> > >>> > > > >> >> > >>> > > > *Requirement:* >> >> > >>> > > > I have a page with 4 different tabs. On one of the tabs, I >> >> want >> >> > to >> >> > >>> use >> >> > >>> > a >> >> > >>> > > > panel with two editable grids for two different static >> dataset >> >> > >>> Add/Edit >> >> > >>> > > > (One grid for tableA, another for tableB). >> >> > >>> > > > >> >> > >>> > > > *Efforts:* >> >> > >>> > > > I have created two separate panel classes as below - each >> with >> >> > >>> it's own >> >> > >>> > > > form and editable grid with it's own editable data provider >> >> with >> >> > >>> > > respective >> >> > >>> > > > array list of different types. The columns supplied to >> >> > EditableGrid >> >> > >>> > class >> >> > >>> > > > contains >> >> > >>> > > > EditableTextFieldPropertyColumn<ClassA, String> and >> <ClassB, >> >> > >>> String> >> >> > >>> > > > respectively with own properties. Please note that I have >> used >> >> > >>> distinct >> >> > >>> > > > markup Ids for each panel and grid components to avoid any >> >> > >>> duplication; >> >> > >>> > > > with setting output markup id to true. >> >> > >>> > > > >> >> > >>> > > > PanelA extends Panel{ >> >> > >>> > > > >> >> > >>> > > > //Constructor >> >> > >>> > > > // formA with editableGridA with >> >> > editableDataProviderForClassA >> >> > >>> > > > } >> >> > >>> > > > >> >> > >>> > > > PanelB extends Panel{ >> >> > >>> > > > >> >> > >>> > > > //Constructor >> >> > >>> > > > //formB with editableGridB with >> >> editableDataProviderForClassB >> >> > >>> using >> >> > >>> > > > } >> >> > >>> > > > >> >> > >>> > > > Those two panels are added into parent panel as below: >> >> > >>> > > > >> >> > >>> > > > TabbedPanel extends Panel{ >> >> > >>> > > > >> >> > >>> > > > //Constructor >> >> > >>> > > > // Panel panelA = new PanelA("aPanel"); >> >> > >>> > > > // Panel panelB = new PanelB("bPanel"); >> >> > >>> > > > // add(panelA); add(panelB); >> >> > >>> > > > } >> >> > >>> > > > >> >> > >>> > > > As I have mentioned in the problem above; clicking on edit >> >> link >> >> > for >> >> > >>> > > classA >> >> > >>> > > > related grid is throwing error for classB property, which >> is >> >> > >>> associated >> >> > >>> > > > with different editable grid. >> >> > >>> > > > >> >> > >>> > > > Has anybody experienced similar issue? Any >> help/suggestions? >> >> > >>> > > > >> >> > >>> > > >> >> > >>> > > Everything looks OK. >> >> > >>> > > Check whether the url for the Ajax call after clicking on the >> >> cell >> >> > >>> > contains >> >> > >>> > > "aPanel" or "bPanel". >> >> > >>> > > >> >> > >>> > > >> >> > >>> > > > >> >> > >>> > > > Thanks, >> >> > >>> > > > -Mihir. >> >> > >>> > > > >> >> > >>> > > >> >> > >>> > >> >> > >>> >> >> > >> >> >> > >> >> >> > > >> >> > >> >> >> > >> > >> > >