我想做的是用分页的响应正文填充DataTable。是否可以在特定的DataTable页面上调用响应正文页面?
例如:
当我转到第3页时,应填写以下请求的回复 http://localhost:8090/relationsByApplication/1?page=3
Repository
public interface MemberRepository extends PagingAndSortingRepository<MemberModel, String>{
public Page<MemberModel> findByApplicationId(long applicationId, Pageable page);}
Service
public List<MemberModel> getRelationsByApplicationId (long applicationId,Pageable page) {
return memberRepository.findByApplicationId(applicationId,page).getContent();}
Controller
@RequestMapping("/relationsByApplication/{id}")
public List<MemberModel> getRelationsByApplicationId(@PathVariable long id, Pageable page) {
return memberService.getRelationsByApplicationId(id, page);}
我已将(http://localhost:8090/relationsByApplication/1)的响应分配给relations
列表,但DataTable仅显示响应的第一页有1页/ 20个元素。
如何实现根据它的页数填充该DataTable并不仅在所选页面上在整个页面上过滤一列?
xhtml
<p:dataTable id="relationTable" var="rel" value="#{index.relations}"
widgetVar="relTable" rows="20" paginator="true"
paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
emptyMessage="No relation found with given criteria"
filteredValue="#{index.filteredRelations}" resizableColumns="true"
draggableColumns="true" scrollable="true" scrollHeight="300">
<p:column headerText="Name" style="width:200px;"
filterBy="#{rel.name}"
sortBy="#{rel.name}" filterMatchMode="contains">
<h:outputText value="#{rel.name}" />
</p:column>
</p:dataTable>
任何帮助将不胜感激。