Complicated answer, coming up.

First, you need to be able to display custom html for a column of your
table.  This is relatively simple to do, but not exactly obvious.  If
you have a column called 'delete', then the table component will
normally look for a 'delete' property of the object representing a
row, and will render the value returned by that property in the table.
 You can override this behaviour by creating a @Block component within
the table declaration in your html. The Block must have the name
'deleteColumnValue' for a 'delete' column, or
'somePropertyColumnValue' for a 'someProperty' column.  Within the
Block, you can put whatever html you like, including other tapestry
components, and that html will be rendered within the column.  This
will allow you to create html which renders a checkbox.  Ideally, your
row object has a boolean property (called 'delete' in my example)
which you can map directly to your checkbox.  Then, when the form is
submitted, you can check which rows have the delete property set to
true and delete those rows. Of course, when I attempted this, I got
very weird behaviour from the table component.  I was using a primary
key converter to represent each row, but when the form was submitted,
the primary keys weren't being converted back into row objects becuase
my primary key convertor wasn't being called.  I still don't know why.
 I modified the behaviour of my code so that the delete column
rendered a button, and it is now only possible to delete a single row
at a time, by pushing the button.  I attach the primary key as a
paramater to the button listener, so I can just issue SQL (or HQL) to
delete the row in question.  Take a look at the TapestryTables.war
file which contains 9 or 10 table tutorials that cover most of this
material pretty well. Just google for 'TapestryTables.war'

--sam


On 4/16/06, Dwi Ardi Irawan <[EMAIL PROTECTED]> wrote:
> maybe it's an old question...
>
> but i've been try to search in this mailing list archive
> and i never got the answer...(or let's say that i don't really understand)
>
> this is my code
>
> .html
>
> ...
>
> <table jwcid="documentsTable" border="1" bordercolor="#CCCCCC"/>
>
> ...
>
> .page
>
> <component id="documentsTable" type="Contrib:Table">
>    <binding name="source" value="listOfDocuments" />
>    <binding name="columns"
> value="'documents.documents_name:Name:documents_name ,
>                    documents.documents_type:Type:documents_type,
>                    documents.documents_path:Path:documents_path'"/>
> </component>
>
>
> .java
>
> ...
> ..
>
> protected String m_documents_name; (primarykey)
> protected String m_documents_type;
> protected String m_documents_path;
>
> <getter and setter ......>
> ...
> ....
>
>
> it will display
>
> ------------------------------------
> Name    |      Type    | Path
> ------------------------------------
>   bla  |     bla       |  bla
>   ...    |     ...         |  ...
>
>
> how can i put the checkbox component inside the contrib:table
> so i can get the value (primarykey) and delete it
>
>
> i want it display like this
>
>
> -------------------------------------------------
>            |    Name    |       Type      | Path
> -------------------------------------------------
> checkbox   |     bla     |     bla       |  bla
> checkbox   |     ...       |     ...        |  ...
>
> .....
> ..
> -------------------------------------------------
>
> [delete button]
>
>
> could anyone help me
> plis...
>
> thnx
>
> dwi ardi irawan
>
> ---------------------------------------------------------------------
> 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