Hi list,

is there a way to programmatically (un)set the edit mode in an inmethod grid?
The issue here is to (un)set the edit mode for _all_ rows of the grid at once.

Currently i use a SubmitCancelColumn which works like a charm.
Overriding SubmitCancelColumn#onSubmitted saves my objects as needed.

But SubmitCancelColumn requires my users to click / save 25 rows one by one.
This is considered tedious. So i try to offer a new button to my users.
Once this button is clicked, all rows in the grid go to edit mode automatically.
Clicked again, all rows save their models automatically. Ideally by calling the
onSubmitted method.
(there is also a cancel-all button).

My code so far is
add(new AjaxLink<Void>("quickedit") {
      @Override
      public void onClick(AjaxRequestTarget target) {
        WebMarkupContainer rows =
(WebMarkupContainer)getPage().get("form:grid:form:bodyContainer:body:row");
        if(rows != null)
          for(Component row : rows) {
            IModel<MyObject> rowModel = (IModel<MyObject>)row.getDefaultModel();
            grid.setItemEdit(rowModel, true);
          }
        datagrid.update();
        target.add(datagrid); // should not be needed
      }
    });

The line with setItemEdit(rowModel, true); gets called for all rows in the grid.
But nothing changes. Display remains the same. Could you please tell me what i'm
doing wrong?

Many thanks for your suggestions

C. Stieglitz

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

Reply via email to