You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Tom Innes <To...@allTiers.com> on 2006/06/22 21:44:03 UTC

Tomahawk DataTable - HOW TO

We are trying to use Tomahawk datatable and datascroller with command links
in the list.  We also want each column to be sortable.  For example a List
of Countries that have Country Codes and Country Names.

 

We have tried various things and have something that comes close.  The issue
we have left is that if you edit a Country on another Page say page 2 and
save that country we lose the page that the user was on.

 

Here is some code snippets from what we are doing.  We are using tomahawk
1.1.3

 

<h:panelGroup id="countryListBody">

                  <t:dataTable id="countryListData"

                        styleClass="scrollerTable"

                        headerClass="standardTable_Header"

                        footerClass="standardTable_Header"

                        rowClasses="standardTable_Row1,standardTable_Row1"

 
columnClasses="standardTable_Column,standardTable_Column,standardTable_Colum
n"

                        var="countryRow"

 
value="#{countryQBEController.listController.dataModel}"

                        rows="10"

 
sortColumn="#{countryQBEController.listController.sortColumn}"

 
sortAscending="#{countryQBEController.listController.ascending}"

                              preserveSort="true"

                        >

 

                              <t:column sortable="true">

                              <f:facet name="header">

                                 <h:outputText value= "Country Code"/>

                              </f:facet>

                                    <h:outputText
value="#{countryRow.countryCode}" />

                              </t:column>

 

                              <t:column sortable="true">

                           <f:facet name="header">

                                 <h:outputText value= "Country Name"/>

                             </f:facet>

                           <h:outputText value="#{countryRow.name}" />

                        </t:column>

                        

                              <t:column sortable="false">

                           <f:facet name="header">

                            <h:outputText value="Edit" />

                             </f:facet>

                                 <t:commandLink
action="#{countryFormController.action.edit}" id="editLink" value="Edit"/>

                        </t:column>

                                    

                    

                      </t:dataTable>

 

            

 

                      

                  <h:panelGrid columns="1" styleClass="scrollerTable2"
columnClasses="standardTable_Column" >

                        <t:dataScroller id="scroll_1"

                            for="countryListData"

                            fastStep="10"

                            pageCountVar="pageCount"

                            pageIndexVar="pageIndex"

                            styleClass="scroller"

                            paginator="true"

                            paginatorMaxPages="9"

                            paginatorTableClass="paginator"

                            paginatorActiveColumnStyle="font-weight:bold;" >

                                          <f:facet name="first" >

                                    <t:graphicImage
url="/images/arrow-first.gif" border="1" />

                                    </f:facet>

                            <f:facet name="last">

                                    <t:graphicImage
url="/images/arrow-last.gif" border="1" />

                            </f:facet>

                                  <f:facet name="previous">

                                    <t:graphicImage
url="/images/arrow-previous.gif" border="1" />

                              </f:facet>

                              <f:facet name="next">

                                    <t:graphicImage
url="/images/arrow-next.gif" border="1" />

                              </f:facet>

                              <f:facet name="fastforward">

                                    <t:graphicImage
url="/images/arrow-ff.gif" border="1" />

                              </f:facet>

                              <f:facet name="fastrewind">

                                    <t:graphicImage
url="/images/arrow-fr.gif" border="1" />

                              </f:facet>

                        </t:dataScroller>

                              <t:dataScroller id="scroll_2"

                               for="countryListData"

                              pageCountVar="pageCount"

                              pageIndexVar="pageIndex"

                              >

                              <h:outputFormat value="Page {0} of {1}"
styleClass="standard" >

                                     <f:param value="#{pageIndex}" />

                               <f:param value="#{pageCount}" />

                              </h:outputFormat>

                        </t:dataScroller>

 

                  </h:panelGrid>

                      

 

                        </h:panelGroup> 

 

 

Some things we have noticed that lead us to believe we are doing something
wrong.

 

1.	If you specify preserveDataModel = "true" on the datatable we will
get a stack trace

java.lang.IllegalArgumentException: row is unavailable

After re-peated Paging and Clicking on the Comand Link to Edit the Row

As well Editting Edits the wrong Record

 

2.	The examples we  have suggest the  sortColumn and sortAscending
properties need to be specified on the data table and stored in a  backing
bean and yet they appear to not be required.  Just saying sortable="true" on
the  t:column works.  Is this the intended behaviour?
3.	If we set the value on the datatable directly to a Results List
instead of the DataModel then the Command Links don't work. ( Always Edits
First Row in the List)
4.	If in our backing bean we don't have a SetDataModel we get a stack
trace.  If we code the setter and have it set the DataModel then paging
doesn't work.  Right now we have the method, but it does nothing.  

 

 

If anybody could advise how the datatable and datascroller should be
configured to work with sorting, command links in the list and paging it
would be appreciated.  

 

Also the Tomahawk examples at irian don't contain an example with all these
features enabled so we are unclear how we can implement these features.

 


Re: Tomahawk DataTable - HOW TO

Posted by Alexandre Jaquet <a....@avintis.com>.
I found an interesting article about dataTable, dataScroller and large 
database :
http://wiki.apache.org/myfaces/WorkingWithLargeTables

You can found a working example of this implementation :
http://wiki.apache.org/myfaces-data/attachments/WorkingWithLargeTables/attachments/myfaces-cars.zip

Hope this help

Alexandre Jaquet wrote:
> Hi Tom,
>
> I encounter some trouble to, if you find the way please post back a 
> working example.Then we can have a simple working tutorial.
> Regards.
>
> Alexandre Jaquet
>
> Tom Innes wrote:
>>
>> We are trying to use Tomahawk datatable and datascroller with command 
>> links in the list. We also want each column to be sortable. For 
>> example a List of Countries that have Country Codes and Country Names.
>>
>> We have tried various things and have something that comes close. The 
>> issue we have left is that if you edit a Country on another Page say 
>> page 2 and save that country we lose the page that the user was on.
>>
>> Here is some code snippets from what we are doing. We are using 
>> tomahawk 1.1.3
>>
>> <h:panelGroup id="countryListBody">
>>
>> <t:dataTable id="countryListData"
>>
>> styleClass="scrollerTable"
>>
>> headerClass="standardTable_Header"
>>
>> footerClass="standardTable_Header"
>>
>> rowClasses="standardTable_Row1,standardTable_Row1"
>>
>> columnClasses="standardTable_Column,standardTable_Column,standardTable_Column"
>>
>> var="countryRow"
>>
>> value="#{countryQBEController.listController.dataModel}"
>>
>> rows="10"
>>
>> sortColumn="#{countryQBEController.listController.sortColumn}"
>>
>> sortAscending="#{countryQBEController.listController.ascending}"
>>
>> preserveSort="true"
>>
>> >
>>
>> <t:column sortable="true">
>>
>> <f:facet name="header">
>>
>> <h:outputText value= "Country Code"/>
>>
>> </f:facet>
>>
>> <h:outputText value="#{countryRow.countryCode}" />
>>
>> </t:column>
>>
>> <t:column sortable="true">
>>
>> <f:facet name="header">
>>
>> <h:outputText value= "Country Name"/>
>>
>> </f:facet>
>>
>> <h:outputText value="#{countryRow.name}" />
>>
>> </t:column>
>>
>> <t:column sortable="false">
>>
>> <f:facet name="header">
>>
>> <h:outputText value="Edit" />
>>
>> </f:facet>
>>
>> <t:commandLink action="#{countryFormController.action.edit}" 
>> id="editLink" value="Edit"/>
>>
>> </t:column>
>>
>> </t:dataTable>
>>
>> <h:panelGrid columns="1" styleClass="scrollerTable2" 
>> columnClasses="standardTable_Column" >
>>
>> <t:dataScroller id="scroll_1"
>>
>> for="countryListData"
>>
>> fastStep="10"
>>
>> pageCountVar="pageCount"
>>
>> pageIndexVar="pageIndex"
>>
>> styleClass="scroller"
>>
>> paginator="true"
>>
>> paginatorMaxPages="9"
>>
>> paginatorTableClass="paginator"
>>
>> paginatorActiveColumnStyle="font-weight:bold;" >
>>
>> <f:facet name="first" >
>>
>> <t:graphicImage url="/images/arrow-first.gif" border="1" />
>>
>> </f:facet>
>>
>> <f:facet name="last">
>>
>> <t:graphicImage url="/images/arrow-last.gif" border="1" />
>>
>> </f:facet>
>>
>> <f:facet name="previous">
>>
>> <t:graphicImage url="/images/arrow-previous.gif" border="1" />
>>
>> </f:facet>
>>
>> <f:facet name="next">
>>
>> <t:graphicImage url="/images/arrow-next.gif" border="1" />
>>
>> </f:facet>
>>
>> <f:facet name="fastforward">
>>
>> <t:graphicImage url="/images/arrow-ff.gif" border="1" />
>>
>> </f:facet>
>>
>> <f:facet name="fastrewind">
>>
>> <t:graphicImage url="/images/arrow-fr.gif" border="1" />
>>
>> </f:facet>
>>
>> </t:dataScroller>
>>
>> <t:dataScroller id="scroll_2"
>>
>> for="countryListData"
>>
>> pageCountVar="pageCount"
>>
>> pageIndexVar="pageIndex"
>>
>> >
>>
>> <h:outputFormat value="Page {0} of {1}" styleClass="standard" >
>>
>> <f:param value="#{pageIndex}" />
>>
>> <f:param value="#{pageCount}" />
>>
>> </h:outputFormat>
>>
>> </t:dataScroller>
>>
>> </h:panelGrid>
>>
>> </h:panelGroup>
>>
>> Some things we have noticed that lead us to believe we are doing 
>> something wrong.
>>
>>    1. If you specify preserveDataModel = “true” on the datatable we
>>       will get a stack trace
>>
>> _java.lang.IllegalArgumentException_: row is unavailable
>>
>> _After re_-peated Paging and Clicking on the Comand Link to Edit the Row
>>
>> _As well Editting Edits the wrong Record_
>>
>>    2. The examples we have suggest the sortColumn and sortAscending
>>       properties need to be specified on the data table and stored in
>>       a backing bean and yet they appear to not be required. Just
>>       saying sortable=”true” on the t:column works. Is this the
>>       intended behaviour?
>>    3. If we set the value on the datatable directly to a Results List
>>       instead of the DataModel then the Command Links don’t work. (
>>       Always Edits First Row in the List)
>>    4. If in our backing bean we don’t have a SetDataModel we get a
>>       stack trace. If we code the setter and have it set the
>>       DataModel then paging doesn’t work. Right now we have the
>>       method, but it does nothing.
>>
>> If anybody could advise how the datatable and datascroller should be 
>> configured to work with sorting, command links in the list and paging 
>> it would be appreciated.
>>
>> Also the Tomahawk examples at irian don’t contain an example with all 
>> these features enabled so we are unclear how we can implement these 
>> features.
>>
>


Re: Tomahawk DataTable - HOW TO

Posted by Alexandre Jaquet <a....@avintis.com>.
Hi Tom,

I encounter some trouble to, if you find the way please post back a 
working example.Then we can have a simple working tutorial.
Regards.

Alexandre Jaquet

Tom Innes wrote:
>
> We are trying to use Tomahawk datatable and datascroller with command 
> links in the list.  We also want each column to be sortable.  For 
> example a List of Countries that have Country Codes and Country Names.
>
>  
>
> We have tried various things and have something that comes close.  The 
> issue we have left is that if you edit a Country on another Page say 
> page 2 and save that country we lose the page that the user was on.
>
>  
>
> Here is some code snippets from what we are doing.  We are using 
> tomahawk 1.1.3
>
>  
>
> <h:panelGroup id="countryListBody">
>
>                   <t:dataTable id="countryListData"
>
>                         styleClass="scrollerTable"
>
>                         headerClass="standardTable_Header"
>
>                         footerClass="standardTable_Header"
>
>                         rowClasses="standardTable_Row1,standardTable_Row1"
>
>                         
> columnClasses="standardTable_Column,standardTable_Column,standardTable_Column"
>
>                         var="countryRow"
>
>                         
> value="#{countryQBEController.listController.dataModel}"
>
>                         rows="10"
>
>                               
> sortColumn="#{countryQBEController.listController.sortColumn}"
>
>                               
> sortAscending="#{countryQBEController.listController.ascending}"
>
>                               preserveSort="true"
>
>                         >
>
>  
>
>                               <t:column sortable="true">
>
>                               <f:facet name="header">
>
>                                  <h:outputText value= "Country Code"/>
>
>                               </f:facet>
>
>                                     <h:outputText 
> value="#{countryRow.countryCode}" />
>
>                               </t:column>
>
>  
>
>                               <t:column sortable="true">
>
>                            <f:facet name="header">
>
>                                  <h:outputText value= "Country Name"/>
>
>                              </f:facet>
>
>                            <h:outputText value="#{countryRow.name}" />
>
>                         </t:column>
>
>                        
>
>                               <t:column sortable="false">
>
>                            <f:facet name="header">
>
>                             <h:outputText value="Edit" />
>
>                              </f:facet>
>
>                                  <t:commandLink 
> action="#{countryFormController.action.edit}" id="editLink" value="Edit"/>
>
>                         </t:column>
>
>                                    
>
>                     
>
>                       </t:dataTable>
>
>  
>
>            
>
>  
>
>                      
>
>                   <h:panelGrid columns="1" styleClass="scrollerTable2" 
> columnClasses="standardTable_Column" >
>
>                         <t:dataScroller id="scroll_1"
>
>                             for="countryListData"
>
>                             fastStep="10"
>
>                             pageCountVar="pageCount"
>
>                             pageIndexVar="pageIndex"
>
>                             styleClass="scroller"
>
>                             paginator="true"
>
>                             paginatorMaxPages="9"
>
>                             paginatorTableClass="paginator"
>
>                             
> paginatorActiveColumnStyle="font-weight:bold;" >
>
>                                           <f:facet name="first" >
>
>                                     <t:graphicImage 
> url="/images/arrow-first.gif" border="1" />
>
>                                     </f:facet>
>
>                             <f:facet name="last">
>
>                                     <t:graphicImage 
> url="/images/arrow-last.gif" border="1" />
>
>                             </f:facet>
>
>                                   <f:facet name="previous">
>
>                                     <t:graphicImage 
> url="/images/arrow-previous.gif" border="1" />
>
>                               </f:facet>
>
>                               <f:facet name="next">
>
>                                     <t:graphicImage 
> url="/images/arrow-next.gif" border="1" />
>
>                               </f:facet>
>
>                               <f:facet name="fastforward">
>
>                                     <t:graphicImage 
> url="/images/arrow-ff.gif" border="1" />
>
>                               </f:facet>
>
>                               <f:facet name="fastrewind">
>
>                                     <t:graphicImage 
> url="/images/arrow-fr.gif" border="1" />
>
>                               </f:facet>
>
>                         </t:dataScroller>
>
>                               <t:dataScroller id="scroll_2"
>
>                                for="countryListData"
>
>                               pageCountVar="pageCount"
>
>                               pageIndexVar="pageIndex"
>
>                               >
>
>                               <h:outputFormat value="Page {0} of {1}" 
> styleClass="standard" >
>
>                                      <f:param value="#{pageIndex}" />
>
>                                <f:param value="#{pageCount}" />
>
>                               </h:outputFormat>
>
>                         </t:dataScroller>
>
>  
>
>                   </h:panelGrid>
>
>                       
>
>  
>
>                         </h:panelGroup>
>
>  
>
>  
>
> Some things we have noticed that lead us to believe we are doing 
> something wrong.
>
>  
>
>    1. If you specify preserveDataModel = "true" on the datatable we
>       will get a stack trace
>
> _java.lang.IllegalArgumentException_: row is unavailable
>
> _After re_-peated Paging and Clicking on the Comand Link to Edit the Row
>
> _As well Editting Edits the wrong Record_
>
>  
>
>    2. The examples we  have suggest the  sortColumn and sortAscending
>       properties need to be specified on the data table and stored in
>       a  backing bean and yet they appear to not be required.  Just
>       saying sortable="true" on the  t:column works.  Is this the
>       intended behaviour?
>    3. If we set the value on the datatable directly to a Results List
>       instead of the DataModel then the Command Links don't work. (
>       Always Edits First Row in the List)
>    4. If in our backing bean we don't have a SetDataModel we get a
>       stack trace.  If we code the setter and have it set the
>       DataModel then paging doesn't work.  Right now we have the
>       method, but it does nothing. 
>
>  
>
>  
>
> If anybody could advise how the datatable and datascroller should be 
> configured to work with sorting, command links in the list and paging 
> it would be appreciated. 
>
>  
>
> Also the Tomahawk examples at irian don't contain an example with all 
> these features enabled so we are unclear how we can implement these 
> features.
>
>  
>


Re: question for inputsuggestajax

Posted by Gerald Müllan <bi...@gmail.com>.
Hi,

try to switch to the newest release, it should work with it.
But to my mind it also worked with 1.1.1;

Is it the dojo component, or the old prototype version without the
arrow on the right side?

cheers,

Gerald

On 6/22/06, Yasushi Okubo <ya...@cabm.rutgers.edu> wrote:
> Hi, experts
>
> I think this question has been posted multiple times, but could not find
> the answer now.
> I am using myfaces.1.1.1 and it looks like inputSuggestAjax only works
> when I  choose state_saving_method=client, not server.
>
> Is it a correct observation ?
> If I move to 1.1.2, can I use  inputSuggestAjax +
> state_saving_method=server ?
>
> Thanks,
> yasushi
>
> <context-param>
>         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>         <param-value>client</param-value>
>         <description>
>             State saving method: "client" or "server" (= default)
>             See JSF Specification 2.5.2
>         </description>
>     </context-param>
>


-- 
Gerald Müllan
Schelleingasse 2/11
1040 Vienna, Austria
0043 699 11772506
gerald.muellan@gmail.com

Re: question for inputsuggestajax

Posted by Matthias Wessendorf <ma...@apache.org>.
I think nothing has been changed, gerald ?

On 6/22/06, Yasushi Okubo <ya...@cabm.rutgers.edu> wrote:
> Hi, experts
>
> I think this question has been posted multiple times, but could not find
> the answer now.
> I am using myfaces.1.1.1 and it looks like inputSuggestAjax only works
> when I  choose state_saving_method=client, not server.
>
> Is it a correct observation ?
> If I move to 1.1.2, can I use  inputSuggestAjax +
> state_saving_method=server ?
>
> Thanks,
> yasushi
>
> <context-param>
>         <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
>         <param-value>client</param-value>
>         <description>
>             State saving method: "client" or "server" (= default)
>             See JSF Specification 2.5.2
>         </description>
>     </context-param>
>


-- 
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

question for inputsuggestajax

Posted by Yasushi Okubo <ya...@cabm.rutgers.edu>.
Hi, experts
 
I think this question has been posted multiple times, but could not find 
the answer now.
I am using myfaces.1.1.1 and it looks like inputSuggestAjax only works 
when I  choose state_saving_method=client, not server.

Is it a correct observation ?
If I move to 1.1.2, can I use  inputSuggestAjax + 
state_saving_method=server ?

Thanks,
yasushi

<context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
        <description>
            State saving method: "client" or "server" (= default)
            See JSF Specification 2.5.2
        </description>
    </context-param>