Hello,
is it possible to do sorting of columns within datatables using pagination?
Are there any samples? In the showcase there is only sorting and pagination but not both together. When I set the sortby Attribute in the Table it won't do anything on my table. I think it is because I use pagination.
I implemented a lazyModel overriding its load() method. The table content is supplied via hibernate.
Is Pagination + interactive Sorting of columns possible at all?
regards
Pagination + Sorting in DataTables
It can be done. There are some side effects like the scoll bar not extending to the headers and it will not render properly if you try to load and empty dataset. My guess is you do not have a height on the table.
Your p:dataTable should look like this..
You then have to add widths to the p:column tags like this...
Your p:dataTable should look like this..
Code: Select all
<p:dataTable id="table" var="prop" value="#{propList.propList}" scrollable="true" height="100" paginator="true" rows="100" >
Code: Select all
<p:column sortBy="#{prop.propPropertyId}" style="width: 100px;" >
Prime Faces 6.2
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11
Mojarra 2.2.14
Apache Tomcat 9.0
Internet Explorer 10,11
-
- Posts: 29
- Joined: 14 Feb 2011, 12:39
I got my Sorting working now thank you. My Problem now is that the width of the rows will depend on the length of the given column. This means the entities will have different width as the column labels.
How can I disable that?
I think this line will set a maximum width, but I want a fix width.
A column now looks like this:
Thank you.
Edit: Found the Problem: It was the scrolling. Without it works
How can I disable that?
Code: Select all
style="width: 100px;"
A column now looks like this:
Code: Select all
<pf:column sortBy="#{table.name}" filterBy="#{table.name}">
<f:facet name="header">
${resourceBundle['list.name']}
</f:facet>
<h:outputText value="#{list.name}"/>
</pf:column>
Edit: Found the Problem: It was the scrolling. Without
Code: Select all
scrollable="true"
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests