Here's my table, with the link to delete the row working properly.

<table border="1" class="datagrid" jwcid="[EMAIL PROTECTED]: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">
                           <div jwcid="[EMAIL PROTECTED]">
                               <a jwcid="[EMAIL PROTECTED]"
listener="listener:edit" parameters="ognl:components.table.tableRow"></a>
                           </div>
                           <div style="{background:white}" jwcid="
[EMAIL PROTECTED]"/>
                           <div jwcid="[EMAIL PROTECTED]">
                               <a jwcid="[EMAIL PROTECTED]"
listener="listener:delete" parameters="ognl:components.table.tableRow"
onclick="return window.confirm('Deseja remover este registo?');">Apagar</a>
                           </div>
                       </table>



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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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 <[EMAIL PROTECTED]> 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;
> >
> > <div jwcid="[EMAIL PROTECTED]" ...>
> >     <div jwcid="@Directlink ...>
> >         <div jwcid="@Insert" value="ognl:components.table.taleRow"/>
> >     </div>
> > </div>
> >
> > Cheers,
> >
> > PS
> >
> > On 6/2/06, Rui Pacheco <[EMAIL PROTECTED]> 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;
> > > >
> > > > <a jwcid="@DirectLink" listener="ognl:listeners.selectLocale "
> > > > parameters="ognl:components.table.tableRow">select</a>
> > > >
> > > > 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;
> > > >
> > > > <div jwcid="[EMAIL PROTECTED]>
> > > >
> > > >
> > > > Sorry!!
> > > >
> > > > Cheers,
> > > > PS
> > > >
> > > >
> > > > On 6/2/06, Rui Pacheco <[EMAIL PROTECTED]> wrote:
> > > > >
> > > > > In this example, how do you reach the object
> > components.table.tableRow
> > > ?
> > > > >
> > > > > I'm trying to do the exact same thing, but I dont know how to
> attach
> > > the
> > > >
> > > > > ID
> > > > > of the row to the DirectLink. I always end up with 0 and never
the
> > > real
> > > > > ID.
> > > > >
> > > > > What is the components object? Is table the name of the table
that
> > was
> > > > > just
> > > > > declared or is that string just an example without any real
> meaning?
> > > > >
> > > > > Thanks for any help
> > > > > Rui
> > > > >
> > > > >
> > > > >
> > > > > On 6/2/06, Eric Fesler <[EMAIL PROTECTED]> wrote:
> > > > > >
> > > > > > From the Tapestry 3 component reference
> > > > > > (
> > > > > >
> > > > >
> > > >
> > >
> >
>
http://jakarta.apache.org/tapestry/3.0.4/doc/ComponentReference/contrib.Table.html
> > > > > > ):
> > > > > >
> > > > > > <style> td { text-align: center } </style>
> > > > > > <table jwcid="[EMAIL PROTECTED]:Table" width="90%"
> > > > > >     source="ognl:@[EMAIL PROTECTED]()"
> > > > > >     columns="Locale:toString(), Language, Country, Variant,
> > > > > ISO3Language,
> > > > > > ISO3Country, !select"/>
> > > > > > <span jwcid="[EMAIL PROTECTED]">&nbsp;</span>
> > > > > > <span jwcid="[EMAIL PROTECTED]">
> > > > > >     <a jwcid="@DirectLink" listener="ognl:
listeners.selectLocale
> "
> > > > > > parameters="ognl:components.table.tableRow ">select</a>
> > > > > > </span>
> > > > > >
> > > > > >
> > > > > > --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

Reply via email to