You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Tim Downey <ti...@gmail.com> on 2005/05/02 18:49:02 UTC

How to preserve form submit with custom TableColumns

Hi,

I'm working through the Tapestry Tables examples from John Reynolds
and am stumped on how to preserve the FormTable semantics when
overriding the TableColumns in a TableView component.

When the table is a FormTable, clicks on the column headers will use
javascript to submit the form prior to sorting.  This behavior is
necessary for a form table.  I'd like to override the
TableColumns component, but preserve this submit behavior, but don't
quite see how.

Here's the example:

   	<table class="mytable" jwcid="tableView">
	  <span jwcid="tableColumns"/>
	  <span jwcid="tableRows">
          <span jwcid="BirthDateColumnValue@Block">
             <span jwcid="editableBirthDate"/>
          </span>
          <span jwcid="WeightColumnValue@Block">
             <span jwcid="editableWeight"/>
          </span>
	      <span jwcid="tableValues@contrib:TableValues"/>
      </span>
      <tr>
         <td colspan="7" class="tablepager">
            <span jwcid="tablePages@contrib:TableFormPages"/>
         </td>   
      </tr>
      </table>

where tableColumns is defined as:

    <component id="tableColumns" type="contrib:TableColumns">
        <static-binding name="class" value="columnheader"/>
    </component>

How do I specify tableColumns such that it will still perform the form
submit javascript for me?  I didn't see anything like
contrib:TableFormColumns.  Am I missing something?

Regards,
-tim

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How to preserve form submit with custom TableColumns

Posted by Tim Downey <ti...@gmail.com>.
Never mind.  I figured it out myself.... ;)

Just need to remember to call
simpleTableColumn.loadSettings(component) with the enclosing component
to allow for the Blocks.

-tim

On 5/2/05, Tim Downey <ti...@gmail.com> wrote:
> Thanks for the tip.
> 
> Here's one more that is hopefully as easy.  I've switched to building
> the ITableColumn[] dynamically through a method on my page class.  I'm
> following the same pattern as the SimpleTableXXX classes, but I seem
> to be missing something.  I now have proper sorting, naming, and form
> submission when re-sorting the columns, but any attempts to use Blocks
> to change the table values seems to be ignored.
> 
> Do I need to do something special in the ITableColumns to allow them
> to be blocked?  Here's an example of how I'm building a column:
> 
>     private ITableColumn createColumn(String id, String displayName,
>             String expression) {
> 
>         SimpleTableColumn column = new SimpleTableColumn(id, displayName,
>                 new OgnlTableColumnEvaluator(expression), true);
> 
>         column.setColumnRendererSource(SimpleTableColumn.FORM_COLUMN_RENDERER_SOURCE);
> 
>         return column;
>     }
> 
> I'd like to be able to intercept these columns using something like
> the following:
> 
>     <component id="lastPerfReview" type="TextField">
>         <static-binding name="displayName">Last Perf Review</static-binding>
>         <binding name="value"
> expression="components.tableRows.tableRow.lastPerfReviewDate"/>
>     </component>
> 
> then in the html as...
> 
>                     <span jwcid="scrolledTableRows">
>                         <span jwcid="lastPerfReviewDateColumnValue@Block">
>                                         <span jwcid="lastPerfReview"/>
> `                       </span>
>                         <span jwcid="scrolledTableValues@contrib:TableValues"/>
>                     </span>
> 
> As long as I'm specifying the columns using a String in the component
> spec, the Blocks occur just fine.  If I switch to building my own
> instances of SimpleTableColumn, they do not.
> 
> Any idea what I'm doing wrong?
> 
> Regards,
> -tim
> 
> On 5/2/05, Mind Bridge <mi...@yahoo.com> wrote:
> > Hi,
> >
> > That behaviour actually comes from column headers. They are provided from
> > the columns themselves, and TableColumns simply enumerates the columns and
> > renders their headers. You may have more than one TableColumns as a result
> > if you wish.
> >
> > I have to check the example, but as far as I remember, in it the columns
> > were defined using a String.
> >
> > Simply place '*' in front of that column definition string in TableView, and
> > the column headers will automatically start submitting the form.
> >
> > If you are interested in the code, placing the asterix in front causes the
> > following to be invoked on the generated columns:
> >
> > objColumn.setColumnRendererSource(SimpleTableColumn.FORM_COLUMN_RENDERER_SOU
> > RCE);
> >
> > Hope that helps...
> >
> > -mb
> >
> > ----- Original Message -----
> > From: "Tim Downey" <ti...@gmail.com>
> > To: "Tapestry users" <ta...@jakarta.apache.org>
> > Sent: Monday, May 02, 2005 7:49 PM
> > Subject: How to preserve form submit with custom TableColumns
> >
> > Hi,
> >
> > I'm working through the Tapestry Tables examples from John Reynolds
> > and am stumped on how to preserve the FormTable semantics when
> > overriding the TableColumns in a TableView component.
> >
> > When the table is a FormTable, clicks on the column headers will use
> > javascript to submit the form prior to sorting.  This behavior is
> > necessary for a form table.  I'd like to override the
> > TableColumns component, but preserve this submit behavior, but don't
> > quite see how.
> >
> > Here's the example:
> >
> >    <table class="mytable" jwcid="tableView">
> >   <span jwcid="tableColumns"/>
> >   <span jwcid="tableRows">
> >           <span jwcid="BirthDateColumnValue@Block">
> >              <span jwcid="editableBirthDate"/>
> >           </span>
> >           <span jwcid="WeightColumnValue@Block">
> >              <span jwcid="editableWeight"/>
> >           </span>
> >       <span jwcid="tableValues@contrib:TableValues"/>
> >       </span>
> >       <tr>
> >          <td colspan="7" class="tablepager">
> >             <span jwcid="tablePages@contrib:TableFormPages"/>
> >          </td>
> >       </tr>
> >       </table>
> >
> > where tableColumns is defined as:
> >
> >     <component id="tableColumns" type="contrib:TableColumns">
> >         <static-binding name="class" value="columnheader"/>
> >     </component>
> >
> > How do I specify tableColumns such that it will still perform the form
> > submit javascript for me?  I didn't see anything like
> > contrib:TableFormColumns.  Am I missing something?
> >
> > Regards,
> > -tim
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> >
> >
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How to preserve form submit with custom TableColumns

Posted by Tim Downey <ti...@gmail.com>.
Thanks for the tip.

Here's one more that is hopefully as easy.  I've switched to building
the ITableColumn[] dynamically through a method on my page class.  I'm
following the same pattern as the SimpleTableXXX classes, but I seem
to be missing something.  I now have proper sorting, naming, and form
submission when re-sorting the columns, but any attempts to use Blocks
to change the table values seems to be ignored.

Do I need to do something special in the ITableColumns to allow them
to be blocked?  Here's an example of how I'm building a column:

    private ITableColumn createColumn(String id, String displayName, 
            String expression) {

        SimpleTableColumn column = new SimpleTableColumn(id, displayName,
                new OgnlTableColumnEvaluator(expression), true);
        
        column.setColumnRendererSource(SimpleTableColumn.FORM_COLUMN_RENDERER_SOURCE);
        
        return column;
    }

I'd like to be able to intercept these columns using something like
the following:

    <component id="lastPerfReview" type="TextField">
        <static-binding name="displayName">Last Perf Review</static-binding>
        <binding name="value"
expression="components.tableRows.tableRow.lastPerfReviewDate"/>
    </component>


then in the html as...

                    <span jwcid="scrolledTableRows">
                        <span jwcid="lastPerfReviewDateColumnValue@Block">
             				<span jwcid="lastPerfReview"/>
`			</span>
                    	<span jwcid="scrolledTableValues@contrib:TableValues"/>
                    </span>

As long as I'm specifying the columns using a String in the component
spec, the Blocks occur just fine.  If I switch to building my own
instances of SimpleTableColumn, they do not.

Any idea what I'm doing wrong?

Regards,
-tim

On 5/2/05, Mind Bridge <mi...@yahoo.com> wrote:
> Hi,
> 
> That behaviour actually comes from column headers. They are provided from
> the columns themselves, and TableColumns simply enumerates the columns and
> renders their headers. You may have more than one TableColumns as a result
> if you wish.
> 
> I have to check the example, but as far as I remember, in it the columns
> were defined using a String.
> 
> Simply place '*' in front of that column definition string in TableView, and
> the column headers will automatically start submitting the form.
> 
> If you are interested in the code, placing the asterix in front causes the
> following to be invoked on the generated columns:
> 
> objColumn.setColumnRendererSource(SimpleTableColumn.FORM_COLUMN_RENDERER_SOU
> RCE);
> 
> Hope that helps...
> 
> -mb
> 
> ----- Original Message -----
> From: "Tim Downey" <ti...@gmail.com>
> To: "Tapestry users" <ta...@jakarta.apache.org>
> Sent: Monday, May 02, 2005 7:49 PM
> Subject: How to preserve form submit with custom TableColumns
> 
> Hi,
> 
> I'm working through the Tapestry Tables examples from John Reynolds
> and am stumped on how to preserve the FormTable semantics when
> overriding the TableColumns in a TableView component.
> 
> When the table is a FormTable, clicks on the column headers will use
> javascript to submit the form prior to sorting.  This behavior is
> necessary for a form table.  I'd like to override the
> TableColumns component, but preserve this submit behavior, but don't
> quite see how.
> 
> Here's the example:
> 
>    <table class="mytable" jwcid="tableView">
>   <span jwcid="tableColumns"/>
>   <span jwcid="tableRows">
>           <span jwcid="BirthDateColumnValue@Block">
>              <span jwcid="editableBirthDate"/>
>           </span>
>           <span jwcid="WeightColumnValue@Block">
>              <span jwcid="editableWeight"/>
>           </span>
>       <span jwcid="tableValues@contrib:TableValues"/>
>       </span>
>       <tr>
>          <td colspan="7" class="tablepager">
>             <span jwcid="tablePages@contrib:TableFormPages"/>
>          </td>
>       </tr>
>       </table>
> 
> where tableColumns is defined as:
> 
>     <component id="tableColumns" type="contrib:TableColumns">
>         <static-binding name="class" value="columnheader"/>
>     </component>
> 
> How do I specify tableColumns such that it will still perform the form
> submit javascript for me?  I didn't see anything like
> contrib:TableFormColumns.  Am I missing something?
> 
> Regards,
> -tim
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: How to preserve form submit with custom TableColumns

Posted by Mind Bridge <mi...@yahoo.com>.
Hi,

That behaviour actually comes from column headers. They are provided from
the columns themselves, and TableColumns simply enumerates the columns and
renders their headers. You may have more than one TableColumns as a result
if you wish.

I have to check the example, but as far as I remember, in it the columns
were defined using a String.

Simply place '*' in front of that column definition string in TableView, and
the column headers will automatically start submitting the form.


If you are interested in the code, placing the asterix in front causes the
following to be invoked on the generated columns:


objColumn.setColumnRendererSource(SimpleTableColumn.FORM_COLUMN_RENDERER_SOU
RCE);

Hope that helps...

-mb

----- Original Message ----- 
From: "Tim Downey" <ti...@gmail.com>
To: "Tapestry users" <ta...@jakarta.apache.org>
Sent: Monday, May 02, 2005 7:49 PM
Subject: How to preserve form submit with custom TableColumns


Hi,

I'm working through the Tapestry Tables examples from John Reynolds
and am stumped on how to preserve the FormTable semantics when
overriding the TableColumns in a TableView component.

When the table is a FormTable, clicks on the column headers will use
javascript to submit the form prior to sorting.  This behavior is
necessary for a form table.  I'd like to override the
TableColumns component, but preserve this submit behavior, but don't
quite see how.

Here's the example:

   <table class="mytable" jwcid="tableView">
  <span jwcid="tableColumns"/>
  <span jwcid="tableRows">
          <span jwcid="BirthDateColumnValue@Block">
             <span jwcid="editableBirthDate"/>
          </span>
          <span jwcid="WeightColumnValue@Block">
             <span jwcid="editableWeight"/>
          </span>
      <span jwcid="tableValues@contrib:TableValues"/>
      </span>
      <tr>
         <td colspan="7" class="tablepager">
            <span jwcid="tablePages@contrib:TableFormPages"/>
         </td>
      </tr>
      </table>

where tableColumns is defined as:

    <component id="tableColumns" type="contrib:TableColumns">
        <static-binding name="class" value="columnheader"/>
    </component>

How do I specify tableColumns such that it will still perform the form
submit javascript for me?  I didn't see anything like
contrib:TableFormColumns.  Am I missing something?

Regards,
-tim

---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org