try repainting the form instead of the table

-igor

On Thu, Nov 13, 2008 at 2:13 AM, Esko Suomi <[EMAIL PROTECTED]> wrote:
> .....which is not desired. I have a test case which is something like this:
>
>
>   tester.clickLink("form:group:table:rows:1:cells:8:cell:delete", true);
>   tester.assertComponentOnAjaxResponse("form:group:table");
>
>
> group is CheckGroup, table is AjaxFallbackDefaultDataTable and delete is
> AjaxFallbackLink. The code for delete link which is in its own column looks
> like this:
>
>
>   columns.add(new AbstractColumn<MyObject>(new Model("Edit")) {
>             public void populateItem(Item<ICellPopulator<MyObject>> item,
> String id, IModel<MyObject> model) {
>           Fragment f = new Fragment(id, "editlink", getPage());
>                     Link<MyObject> delete = new
> AjaxFallbackLink<MyObject>("delete", model) {
>               @Override
>               public void onClick(AjaxRequestTarget art) {
>                   getAdPersister().delete(getModelObject());
>                   if (art != null) art.addComponent(table);
>               }
>           };
>           delete.add(new Label("label", "delete"));
>           delete.add(new SimpleAttributeModifier("onclick", "return
> confirm('are you sure?');"));
>           f.add(delete);
>           item.add(f);
>       }
>         });
>
>
> and its fragment's markup looks like this:
>
>
>   <wicket:fragment wicket:id="editlink">
>       <a wicket:id="link"><wicket:component
> wicket:id="label"></wicket:component></a>
>       <a wicket:id="delete"><wicket:component
> wicket:id="label"></wicket:component></a>
>   </wicket:fragment>
>
>
> The snippets above works if CheckGroupSelector isn't present. What I wanted
> to do was to add a checkbox to each row as new column and a "select all"
> checkbox to the new column's header so first I added this:
>
>
>   columns.add(new AbstractColumn<MyObject>(new Model("Controls")) {
>       public void populateItem(Item<ICellPopulator<MyObject>> item,
>               String id, IModel<MyObject> model) {
>           Fragment f = new Fragment(id, "checkboxfragment", getPage());
>           f.add(new Check("check", new Model(false)));
>           item.add(f);
>       }
>   });
>
>
> Markup for the fragment is
>
>
>   <wicket:fragment wicket:id="checkboxfragment">
>       <input type="checkbox" wicket:id="check" />
>   </wicket:fragment>
>
>
> I also added the components to hierarchy like so:
>
>
>   CheckGroup myGroup = new CheckGroup("group", new ArrayList());
>   form = new Form("form");
>   table = newTable(); // this method creates the entire table
>   myGroup.add(table);
>   form.add(myGroup);
>
>
> With that everything still works so I added the header override like so:
>
>
>   columns.add(new AbstractColumn<MyObject>(new Model("Controls")) {
>                 @Override
>       public Component<?> getHeader(String componentId) {
>           Fragment f = new Fragment(componentId, "checkboxfragment",
> getPage());
>           f.add(new CheckGroupSelector("check"));
>           return f;
>       }
>
>       public void populateItem(Item<ICellPopulator<MyObject>> item,
>               String id, IModel<MyObject> model) {
>           Fragment f = new Fragment(id, "checkboxfragment", getPage());
>           f.add(new Check("check", new Model(false)));
>           item.add(f);
>       }
>   });
>
>
> and now that I run the test case it now gives me the following exception on
> the line     tester.assertComponentOnAjaxResponse("form:group:table");
>
>
>   junit.framework.AssertionFailedError: Component wasn't found in the AJAX
> response
>
>
> Any ideas how I can get this to work?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to