wicket-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sven Meier <s...@meiers.net>
Subject Re: AjaxFallbackDefaultDataTable: cell not receiving event after sorting
Date Fri, 07 Jun 2013 20:45:00 GMT
Hi,

your solution looks good to me.

Check the Ajax debug window for any problems with the requests. Then put 
a breakpoint on your behavior's #onEvent() and check whether is is 
triggered.

Sven

On 06/07/2013 04:15 PM, dlock wrote:
> Hi.
>
> I have a simple abstract panel that I display as a cell within an
> AjaxFallbackDefaultDataTable.  The panel has a label and a WebComponent that
> shows an icon (based on passed in css).
>
> The WebComponent has an AjaxEventBehaviour("click") added and whenever the
> icon is clicked the handling is delegated to the concrete implementation
> (think of the table cell having an action associated with it, such as edit
> etc).  Below is the (simplified) code of the LabelIconPanel...
>
> public abstract class LabelIconPanel<T> extends Panel
> {
>      private static final long serialVersionUID = 1L;
>      public LabelIconPanel(String id, IModel<T> model, IModel<String> text,
> String cssIcon)
>      {
>          super(id, model);
>
>          Label label = new Label("label", text);
>          
>          Component icon = new WebComponent("icon");
>          icon.add(new AjaxEventBehavior("click")
>          {
>              private static final long serialVersionUID = 1L;
>
>              @Override
>              protected void onEvent(AjaxRequestTarget target)
>              {
>                  LabelIconPanel.this.onClick(target);
>              }
>          });
>
>          icon.add(new AttributeAppender("class", new Model<String>(cssIcon),
> " "));
>          add(label);
>          add(icon);
>      }
>      public abstract void onClick(AjaxRequestTarget target);
> }
> _____________________
>
> The panel is added to the table via a PropertyColumn like so...
>
> new PropertyColumn<SomePojo, String>(new Model<String>("Some header"),
> "someProperty")
>              {
>                  private static final long serialVersionUID = 1L;
>
>                  @Override
>                  public void populateItem(Item<ICellPopulator&lt;SomePojo>>
> item, String componentId, final IModel<SomePojo> rowModel)
>                  {
>
>                      LabelIconPanel<SomePojo> labelIconPanel =
>                          new LabelIconPanel<SomePojo>(componentId, rowModel,
> new Model<String>(
>                              rowModel.getObject().getPropertyValue()),
> "icon-pencil")
>                          {
>                              private static final long serialVersionUID = 1L;
>
>                              @Override
>                              public void onClick(AjaxRequestTarget target)
>                              {
>                                    // handle the icon being clicked
> here...show a dialog to edit property etc.
>                              }
>                          };
>
>                      item.add(labelIconPanel);
>                  }
>              }
>
> ____________________________
>
> The issue I am having is that when I sort the table via the header, the icon
> in the above panel is no longer receiving the click event (for any rows).
> If I revert the sort, the icons in each row work as expected.  If I refresh
> the page after sorting, the icons work as expected.
>
> This is my first post on here as I am new to Wicket development, so any
> pointers as to what might be going on or suggestions as to where I might
> need to start looking would be appreciated.
>
> dl
>
>
>
>
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/AjaxFallbackDefaultDataTable-cell-not-receiving-event-after-sorting-tp4659277.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Mime
View raw message