Hi Rui,
why don't you use row property in the table component. this would be the
source,
<table
source="ognl:dataItems"
columns="!id:ID:InventionsDiscoveriesID,
!heading:TÃÂtulo:Heading, !date:Data da Invenção:InventionDate,
!inventor:Inventor:Inventor, !status:Activo:Status, !delete"
pageSize="10"
columnsClass="titulo"
rowsClass="titulo"
row="ognl:rowObject">
and you add bean object as a temp object for rendering each row of the table.
private Model rowObject;
public Model getRowObject(){
return rowObject;
}
public void setRowObject(Model rowObject){
this.rowObject=rowObject;
}
and this rowObject is the one that you passed to your delete listener,
<a listener="listener:delete" parameters="ognl:rowObject"
onclick="return window.confirm('Deseja remover este registo?');">Apagar..</a>
hope this would do the trick.
regards,
Gunna
Rui Pacheco <[EMAIL PROTECTED]> wrote: Here's my table, with the link to
delete the row working properly.
source="ognl:dataItems" columns="!id:ID:InventionsDiscoveriesID,
!heading:TÃÂtulo:Heading, !date:Data da Invenção:InventionDate,
!inventor:Inventor:Inventor, !status:Activo:Status, !delete" pageSize="10"
columnsClass="titulo" rowsClass="titulo">
listener="listener:edit" parameters="ognl:components.table.tableRow">
listener="listener:delete" parameters="ognl:components.table.tableRow"
onclick="return window.confirm('Deseja remover este registo?');">Apagar
And here's my bean:
public abstract class InventionsList extends AbstractListPage {
public static final IPropertySelectionModel inventionSearchCriteria =
new StringPropertySelectionModel(new String[]{ "ID", "Titulo", "Data de
Inven��o", "Inventor" });
public void delete(Object obj){
Model parm = (Model)obj;
// System.err.println( parm.getInventionsDiscoveriesID() );
}
public void edit(IRequestCycle cycle){
}
public void search(IRequestCycle cycle){
if(model.getSearchCriteria().equals("Data de Inven��o"))
model.setSearchCriteria("InventionDate");
}
/**
* Necess�rio para implementar a navega��o da tabela.
* N�o apagar mesmo que m�todo vazio.
* */
public void onSubmit(){
}
public void pageBeginRender(PageEvent event){
setModel(model);
MySQLDAO mysql = new MySQLDAO(this.getDataSource(), model);
List list = mysql.selectInventionsDiscoveries();
setDataItems(list);
}
}
On 6/2/06, Peter Svensson
wrote:
>
> No problem. The learning curve of tables is nearly vertical. However, you
> must give some more info.
>
> First of all, paste your html page and your class file and it'll be easier
> to spot the miss, wherever it is.
>
> Cheers,
> PS
>
> On 6/2/06, Rui Pacheco wrote:
> >
> > Argh, almost there.
> >
> > If I print the TableRow object, it'll print the description of the
> object,
> > so I need to find a way to retrieve it from that object. I was thinking
> > about ognl, but I dont know if I can use it for this.
> >
> > I am sorry for dragging this and for needing so much hand holding, but
> > these
> > tables are really killing me. If its of any worth, there aren't that
> many
> > examples on the web about this kind of stuff, and these will stay on
> > gmane's
> > archives, so someone else will benefit from them.
> >
> > On 6/2/06, Peter Svensson
wrote:
> > >
> > > Try to just make the listener take an Object argument, like public
> void
> > > myListener(Object o) and the cast it to what you think it should be
> > later
> > > on. Maybe you could use the actual class instead of Object, I can't
> > > remember
> > > at the moment.
> > >
> > > To see the value and make it clickabel (should have thought of this
> > > earlier
> > > :), do;
> > >
> > >
> > >
> > >
> > >
> > >
> > > Cheers,
> > >
> > > PS
> > >
> > > On 6/2/06, Rui Pacheco wrote:
> > > >
> > > > Peter,
> > > >
> > > > Dont apologize, we're all busy here.
> > > >
> > > > Two more questions and I should be done:
> > > > How do I catch the object on my listener? I tried passing a Table, a
> > > > Component and a TableRow as a parameter but I don't know how to
> reach
> > > the
> > > > object that contains the field I need.
> > > >
> > > > Another thing, how do I make a value in the middle of the table
> > > clickable
> > > > while maintaining its value? If I use a Block component it will
> > > overwrite
> > > > whats on the source for my table.
> > > >
> > > > On 6/2/06, Peter Svensson < [EMAIL PROTECTED]> wrote:
> > > > >
> > > > > I might have made some mistake, Rui, since I typed it from memory,
> > as
> > > I
> > > > > don't have a static table left in my app. Sorry in that case.
> > > > >
> > > > > But I might help anyway, the line you ask about from the other
> mail;
> > > > >
> > > > >
> > > > > parameters="ognl:components.table.tableRow">select
> > > > >
> > > > > the last ognl statement expands to;
> > > > > getComponents().getTable().getTableRow(), where getComponents() is
> a
> > > > > method
> > > > > which must exist in your current page class. And it does! Since
> > your
> > > > page
> > > > >
> > > > > class is most probably derived from BaseComponent, which
> implenents
> > > > > getComponents.
> > > > >
> > > > > That's actually a very usefull method, since you easily gains
> access
> > > to
> > > > > all
> > > > > you components in the page from your java code.
> > > > >
> > > > > And I would also recommend you to pass the current object directly
> > as
> > > an
> > > > > argument in the link, instead of just the ID, so you don't have to
> > go
> > > > dig
> > > > > for it later;
> > > > >
> > > > > Argh!!!! Now I see my fault. I'm so used working with trails,
> where
> > > you
> > > > > just say the name of the property and be done with it, the proper
> > > syntax
> > > > > to
> > > > > override the contrib:Table column is of course;
> > > > >
> > > > >
> > > > > > > source="ognl:@[EMAIL PROTECTED]()"
> > > > > > > columns="Locale:toString(), Language, Country, Variant,
> > > > > > ISO3Language,
> > > > > > > ISO3Country, !select"/>
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > parameters="ognl:components.table.tableRow ">select
> > > > > > >
> > > > > > >
> > > > > > >
> > > > > > > --ERic
> > > > > > >
> > > > > > >
> > > > > > >
> > > >
> ---------------------------------------------------------------------
> > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > > > > > > For additional commands, e-mail:
> [EMAIL PROTECTED]
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Cumprimentos,
> > > > > > Rui Pacheco
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > > --
> > > > Cumprimentos,
> > > > Rui Pacheco
> > > >
> > > >
> > >
> > >
> >
> >
> > --
> > Cumprimentos,
> > Rui Pacheco
> >
> >
>
>
--
Cumprimentos,
Rui Pacheco
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com