| Author |
Sorting in h:dataTable
|
Karthik Krishna
Greenhorn
Joined: Sep 02, 2008
Posts: 11
|
|
Hi, I have this jsf datatable: <h:dataTable id="UserList" headerClass="headerClass" rowClasses="tableOddRow, tableEvenRow" styleClass="dataTable" value="#{userListBean.dataModel}"> <h:column> <f:facet name="header"> <h utputText value="User Id" /> </f:facet> <h utputText value="#{bean.userId}" /> </h:column> I am looking to sort it by the parameter "User Id" without sorting the list in the bean. How could I achieve it ? I am using JSF 1.1 .Could anyone please help ?
|
Pass on the knowledge!!
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14572
|
|
The stock JSF datatable control doesn't support column sorting. You'll need an extended datatable control like the one that Tomahawk provides. Of course if you're talking a LARGE collection such as a view into a database that's going to span multiple display pages, the rules are different, because at that level, you should have used a SQL with ordering.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Karthik Krishna
Greenhorn
Joined: Sep 02, 2008
Posts: 11
|
|
Hi Tim, I have tried using Tomohawk 1.1.3 along with myfaces-impl-1.1.4 and myfaces-api-1.1.4 but it does not solve my issue. The issue being trying to use <t:dataTable to work with JSF 1.1 so that I could sort the list and provide the user with a capability of sorting when they click any header on the list. The issues I have been facing is : 1)using Tomahawk 1.1.3,myfaces-impl-1.1.4,myfaces-api-1.1.4 instead of Tomahawk 1.0 screws up my existing application i.e I keep getting application error. I cannot chase those error because they are far too many and it would be time consuming to fix those than get the sorting feature working. 2) Using <display:table the issue is that say I have 3 JSPs namely A.jsp , B.jsp , C.jsp A.jsp is the main page and B.jsp, C.jsp are tabbed pane ( using <corejsf:tabpane> tag ) . A.jsp uses : <h:form id MainInfo> <f:subview id = TabInfo > <h:panelGrid width="100%" rendered="#{Bean.list.Infomation}"> <corejsf:tabbedPane id="TabPaneNew" styleClass="coreJsfTabbedPane" tabClass="coreJsfTab" selectedTabClass="coreJsfSelectedTab"> <f:selectItems value="#{tabPagesBean.showTabs}" /> </corejsf:tabbedPane> </h:panelGrid> </f:subview> </h:form> B.jsp and C.jsp are tabbed panes. To get the <display:table to render in B.jsp and C.jsp it says you need to wrap it in a <h:form > </h:form>. I wrapped the whole information in B.jsp with the <h:form > </h:form> tag, when i click either the C tab or click the B tab I get the following error msg : TabInfo.MainInfo.TabPaneNew in null or not an object I know we cannot use a <h: form > within a <h:form> but how could i get this working?
|
 |
S Das
Greenhorn
Joined: Nov 01, 2008
Posts: 3
|
|
Hi Karthik, Try JBoss Richface JSF component. It has a lot of cool components to use. Here is the site for all component demo: http://livedemo.exadel.com/richfaces-demo/index.jsp Expand the Data Iteration panel on the left and the last example is for data sorting. A simple tag attribute will bring in the sort icon on the screen and also sort the data based on the field you mention. Be little careful to select the Richface version if you are downloading it. The latest 3.2 works with JSF 1.2. Download any of the previous versions.
|
Thanks,<br />Sudipto<br /> <br />"Build the Java Community"
|
 |
 |
|
|
subject: Sorting in h:dataTable
|
|
|