You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Patrick Hesse <in...@patrick-hesse.de> on 2007/05/11 17:38:39 UTC
Re: T5 - Adding modify/delete actions to a Grid
Hello,
i think i have a solution for Option 2 (extend the default BeanModel)
1.) in your ControllerClass add this code:
@Inject
private BeanModelSource _modelSource;
@Inject
private ComponentResources _resources;
public BeanModel getModelForGrid() {
PropertyConduit pc = new ActionPC();
BeanModel result = _modelSource.create(User.class, false, _resources);
result.add("Action", pc);
result.get("Action").order(result.getPropertyNames().size()-1);
return result;
}
2.) create a class that implements the PropertyConduit Interface
class ActionPC implements PropertyConduit {
public Object get(Object arg0) {return "";}
public Class getPropertyType() {return String.class;}
public void set(Object arg0, Object arg1) {}
public <T extends Annotation> T getAnnotation(Class<T> arg0) {return null;}
}
3.) in your template reference the Model to your Function
<table t:type="grid" rowsPerPage="10" source="users" row="currentUser"
model="ModelForGrid">
i dont know, if this all correct, but it's the solution for my problem.
have a nice Weekend
Patrick Hesse
Bogdan Calmac-4 wrote:
>
> <-- snip -->
>
> Option 2: Create an implementation of BeanModel that includes the two
> extra columns for "modify" and "delete" and pass it to the Grid. The
> question here is how to programmatically create the default BeanModel
> for my POJO (as the Grid does internally) so that I only add the 2 new
> properties instead of listing all the properties of the POJO?
>
> <-- snap -->
>
--
View this message in context: http://www.nabble.com/T5---Adding-modify-delete-actions-to-a-Grid-tf3370935.html#a10434372
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org