Hi Laurent,

The problem is the JavaScript error: Uncaught TypeError: b is null.

It seems there is some bug in
"Wicket.CheckboxSelector.updateSelectorState(c,e)},initializeSelector:function(c,d){var
b=document.getElementById(c); ..."

Due to this JS error Wicket cannot replace neither the feedback panel nor
any other component.

You should focus on debugging the JavaScript. If you don't know how to do
it then please create a quickstart app that reproduces the problem and
share it with us.


On Mon, Nov 7, 2022 at 6:37 PM Laurent Duparchy <dupar...@esrf.fr> wrote:

> If I add the entire page (which is defeating the entire "Ajax" idea.... I
> think.), it works. The new list is painted
>  > target.get().add(getPage());
>
> If I add only the feedback panel, it is is painted.
>  > target.get().add(feedbackPanel);
>
> If I add both, the feedbackpanel is not painted... Go figure.
>
> I probably don't understand what a "target" is and I'm giving up that.
> Sorry for being an annoyance.
>
>
> *Laurent Duparchy
> ESRF - The European Synchrotron
> MIS Unit
> 04 76 88 22 56*
> Laurent Duparchy wrote on 03/11/2022 10:11:
> > Yes I corrected that HTML too. (which was auto-corrected by browsers I
> think, at least by Firefox).
> >
> > I looked for errors in Firefox debugger.  The console reports a warning
> then an error in a generated js :
> >
> > Warning :
> >> jQuery.Deferred exception: b is null updateSelectorState@
> https://xxxxxx/misapps/wakeOnLan/wicket/resource/org.apache.wicket.markup.html.form.AbstractCheckSelector/CheckSelector-ver-1CE61F040D59ED57EADC3FBB51E1E02C.js:1:392
> attachUpdateHandlers@
> https://xxxxxx.esrf.fr/misapps/wakeOnLan/wicket/resource/org.apache.wicket.markup.html.form.AbstractCheckSelector/CheckSelector-ver-1CE61F040D59ED57EADC3FBB51E1E02C.js:1:598
> >
> > Error :
> >
> >> Uncaught TypeError: b is null
> >>
> >>  in
> >>
> >>
> (function(a){if(typeof(Wicket.CheckboxSelector)==="object"){return}Wicket.CheckboxSelector={updateAllCheckboxes:function(f,e){var
> d=e();for(var b=0;b<d.length;b++){var
> c=d[b];if(c.checked!==f){c.click()}}},updateSelectorState:function(e,g){var
> f=g(),c=f.length>0;for(var
> d=0;d<f.length;d++){if((f[d].disabled===false)&&(f[d].checked===false)){c=false;break}}var
> b=document.getElementById(e);b.checked=c},attachUpdateHandlers:function(c,e){var
> d=e(),f=function(){Wicket.CheckboxSelector.updateSelectorState(c,e)};for(var
> b=0;b<d.length;b++){Wicket.Event.add(d[b],"click",f)}Wicket.CheckboxSelector.updateSelectorState(c,e)},initializeSelector:function(c,d){var
> b=document.getElementById(c);Wicket.Event.add(b,"click",function(){Wicket.CheckboxSelector.updateAllCheckboxes(b.checked,d)})},findCheckboxesFunction:function(c,b){return
> function(){var d=[];var
> g=document.getElementById(c).getElementsByTagName("input");for(var
> e=0;e<g.length;e++){var f=g[e];if(f.name===b){d.push(f)}}return
> >> d}},getCheckboxesFunction:function(b){return function(){var
> c=[];for(var e=0;e<b.length;e++){var
> d=document.getElementById(b[e]);if(d){c.push(d)}}return c}}}})();
> >
> >
> >
> >
> > *Laurent Duparchy
> > ESRF - The European Synchrotron
> > MIS Unit
> > 04 76 88 22 56*
> > Sven Meier wrote on 03/11/2022 09:38:
> >> That HTML doesn't look valid to me:
> >>
> >> Your THs belong inside a TR, and while you're at it move that one into
> a THEAD.
> >>
> >> https://www.w3schools.com/tags/tag_th.asp
> >>
> >> Maybe this is just a problem with replacing the HTML in the browser,
> this is why I adviced you to check the response of the Ajax request in the
> Browser network tab.
> >>
> >> Sven
> >>
> >>
> >> On 03.11.22 08:11, Laurent Duparchy wrote:
> >>> You need more than that ?
> >>>
> >>>> <div id="wakeUpForm">
> >>>>            <form wicket:id = "wakeUpForm">
> >>>>            <div wicket:id="devicesGroup">
> >>>>
> >>>>                <table  class="wakeUptable" >
> >>>>                  <th><wicket:message key="selectMessage"/></th>
> >>>>                  <th><wicket:message key="hostNameMessage"/></th>
> >>>>                  <th><wicket:message key="macMessage"/></th>
> >>>>                  <th><wicket:message key="reachable"/></th>
> >>>>                  <th><wicket:message key="removeMessage"/></th>
> >>>>                  <tbody>
> >>>>                       <tr wicket:id="userDevicesListView">
> >>>> ...
> >>>>          </div>
> >>>
> >>>
> >>>
> >>> *Laurent Duparchy
> >>> ESRF - The European Synchrotron
> >>> MIS Unit
> >>> 04 76 88 22 56*
> >>> Sven Meier wrote on 02/11/2022 17:38:
> >>>> Show us the relevant markup please.
> >>>>
> >>>> Sven
> >>>>
> >>>>
> >>>> On 02.11.22 15:13, Laurent Duparchy wrote:
> >>>>> Hi,
> >>>>>
> >>>>> Yes, *devicesGroup *is initially visible. Everything seems fine in
> terms of Ajax request/response.
> >>>>>
> >>>>> When I add only the *feedbackpanel*, it is correctly added and
> painted with the correct feedback message
> >>>>> When I add *devicesGroup*, nothing is repainted, including the
> *feedbackpanel*.
> >>>>>
> >>>>> I tried to add only the *userDevicesListView *for repaint, but there
> is an error saying that it's not possible to add a repeater and to add its
> parent... which is devicesGroup.
> >>>>>
> >>>>> There's probably a flaw in the devicesGroup design. Basically it
> contains a list of items w/ two possible ajax action : "check" and "delete".
> >>>>>
> >>>>> "Check" will only gives a result in the feedback panel and is
> working fine.
> >>>>> "Delete" will, you guessed, delete the item and repaint the list.
> The item is truly deleted, in the database and /userDevices /list is
> reloaded.
> >>>>>
> >>>>>
> >>>>> it is designed as follow (worked fined w/ Wicket 1.4)
> >>>>> /
> >>>>> private class UserDevicesLoadableDetachableModel extends
> LoadableDetachableModel {
> >>>>>
> >>>>>         private List userDevices ;
> >>>>> ...
> >>>>> }
> >>>>>
> >>>>> private class UserDevicesListView extends ListView {
> >>>>>
> >>>>>         public UserDevicesListView(String id,
> UserDevicesLoadableDetachableModel imodel) {
> >>>>>             super(id, imodel);
> >>>>>         }
> >>>>> ...
> >>>>> }
> >>>>> /
> >>>>>
> >>>>> /userDevicesListView = new
> UserDevicesListView("userDevicesListView",
> userDevicesLoadableDetachableModel);//
> >>>>> /
> >>>>> /devicesGroup = new CheckGroup<Device>("devicesGroup", new
> ArrayList<>()){//
> >>>>> //    public boolean isVisible() {...}//
> >>>>> //} /
> >>>>> /devicesGroup.setOutputMarkupId(true);//
> >>>>> //devicesGroup.setOutputMarkupPlaceholderTag(true);//
> >>>>> //devicesGroup.setRenderBodyOnly(false);//
> >>>>> //devicesGroup.add(new CheckGroupSelector("devicesGroupSelector"));//
> >>>>> //devicesGroup.add(userDevicesListView);//
> >>>>> //
> >>>>>
> >>>>> //
> >>>>> /
> >>>>> *Laurent Duparchy
> >>>>> ESRF - The European Synchrotron
> >>>>> MIS Unit
> >>>>> 04 76 88 22 56*
> >>>>> Ernesto Reinaldo Barreiro wrote on 29/10/2022 04:06:
> >>>>>> Hi,
> >>>>>>
> >>>>>> is devicesGroup initially visible? if not you need to
> >>>>>> setOutputMarkupplaceHolder(true) in it. Because otherwise wicket
> will not
> >>>>>> output anything for it and AJAX replacement will fail at client
> side.
> >>>>>>
> >>>>>> On Fri, Oct 28, 2022 at 4:27 PM Martin Grigorov<
> mgrigo...@apache.org>
> >>>>>> wrote:
> >>>>>>
> >>>>>>> Hi Laurent,
> >>>>>>>
> >>>>>>> Few questions:
> >>>>>>> 1) is the Ajax call actually executed ?
> >>>>>>> Set a breakpoint inside #onClick() and see whether it breaks
> >>>>>>> 2) Is there any error (Java or JavaScript) ?
> >>>>>>> Check both the server logs and the browser console
> >>>>>>>
> >>>>>>>
> >>>>>>> On Fri, Oct 28, 2022 at 10:45 AM Laurent Duparchy<dupar...@esrf.fr
> >
> >>>>>>> wrote:
> >>>>>>>
> >>>>>>>> Hi,
> >>>>>>>>
> >>>>>>>> Sorry for the basic question.... If this is the wrong place to
> ask,
> >>>>>>> please
> >>>>>>>> tell me.
> >>>>>>>> If there is a relevant documentation to read, tell me as well.
> >>>>>>>>
> >>>>>>>> I'm upgrading a very old & small app from Wicket 1.4 to Wicket 9.
> >>>>>>>>
> >>>>>>>> Following an Ajax call, one component is not refreshed as it was
> before.
> >>>>>>>>
> >>>>>>>> This is the "userDevicesListView" which is inside the
> "devicesGroup"
> >>>>>>>> component. See below.
> >>>>>>>>
> >>>>>>>>> <div id="wakeUpForm">
> >>>>>>>>>            <form wicket:id = "wakeUpForm">
> >>>>>>>>>            <div wicket:id="devicesGroup">
> >>>>>>>>>
> >>>>>>>>>                <table  class="wakeUptable" >
> >>>>>>>>>                  <th><wicket:message key="selectMessage"/></th>
> >>>>>>>>>                  <th><wicket:message key="hostNameMessage"/></th>
> >>>>>>>>>                  <th><wicket:message key="macMessage"/></th>
> >>>>>>>>>                  <th><wicket:message key="reachable"/></th>
> >>>>>>>>>                  <th><wicket:message key="removeMessage"/></th>
> >>>>>>>>>                  <tbody>
> >>>>>>>>>                       <tr wicket:id="userDevicesListView">
> >>>>>>>>> ...
> >>>>>>>>>          </div>
> >>>>>>>> Upon the Ajax call the userDevicesListView is changed and
> devicesGroup is
> >>>>>>>> added to the target and should be rendered / repainted but it is
> not.
> >>>>>>>>
> >>>>>>>>> public void onClick(Optional<AjaxRequestTarget> target) {
> >>>>>>>>>              Device deviceToRemove = (Device) getModelObject();
> >>>>>>>>>              try {
> >>>>>>>>>                  removeDevice(deviceToRemove, user);
> >>>>>>>>>                  info(deviceToRemove.getHostName() + " " +
> >>>>>>>> getString("device.removed"));
> >>>>>>>>>              } catch (Exception e) {
> >>>>>>>>>
> >>>>>>>>>                  LOG.error("error while deleting" +
> >>>>>>>> deviceToRemove.getHostName(), e);
> >>>>>>>>>                  error(e);
> >>>>>>>>>
> >>>>>>>>>              }
> >>>>>>>>>
> >>>>>>>>>              target.get().add(devicesGroup);
> >>>>>>>>>              target.get().add(feedbackPanel);
> >>>>>>>>>          }
> >>>>>>>>
> >>>>>>>>
> >>>>>>>>
> ---------------------------------------------------------------------
> >>>>>>>> To unsubscribe, e-mail:users-unsubscr...@wicket.apache.org
> >>>>>>>> For additional commands, e-mail:users-h...@wicket.apache.org
> >>>>>>>>
> >>>>>>>>
> >>>>>>
> >>>>>
> >>>>
> >>>> ---------------------------------------------------------------------
> >>>> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >>>> For additional commands, e-mail: users-h...@wicket.apache.org
> >>>>
> >>>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> >> For additional commands, e-mail: users-h...@wicket.apache.org
> >>
> >
>

Reply via email to