简体   繁体   English

JSF和Primefaces:sortyBy不起作用(无可见箭头)

[英]JSF and Primefaces: sortyBy doesn't work (no arrows visible)

basically I don't know why, but those arrows next to row headers are not showing for "Oseba" column. 基本上我不知道为什么,但是“ Oseba”列的行标题旁边的那些箭头没有显示。 Here is code where it's not working, where it is working and how it should look like. 这是不起作用的代码,起作用的代码以及它的外观。

<p:dataTable emptyMessage="Ni zapisov" id="dataTable" var="cont" value="#{contactsBean.contactDataModel}"
                     paginator="true" rows="20" rowKey="#{cont.idContact}"  paginatorPosition="bottom" rowsPerPageTemplate="10,20,30" 
                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                     lazy="true" style="width:100%"  sortBy="cont.firstName" sortOrder="ASCENDING" filterDelay="400">

                    <p:column headerText="Oseba" sortyBy="#{cont.cont.firstName}" filterBy="#{cont.fullName}" filterMatchMode="contains" >
                         <h:outputText value="#{cont.firstName} #{cont.lastName}" />
                    </p:column>

                    <p:column  headerText="Naslov" sortBy="#{cont.cont.address}" filterBy="#{cont.cont.address}" filterMatchMode="contains" >
                        <h:outputText value="#{cont.address}" />
                    </p:column>

                    <p:column  headerText="Pošta" sortBy="#{cont.cont.zip.name}" filterBy="#{cont.zipAddress}" filterMatchMode="contains" >
                         <h:outputText value="#{cont.zip.name} #{cont.zip.zipId}" />
                    </p:column>

                    <p:column  headerText="Telefon" sortBy="#{cont.cont.phoneNum}" filterBy="#{cont.cont.phoneNum}" filterMatchMode="contains" >
                         <h:outputText value="#{cont.phoneNum}" />
                    </p:column>

                    <p:column headerText="Email" sortBy="#{cont.cont.EMail}" filterBy="#{cont.cont.EMail}" filterMatchMode="contains" >
                        <h:outputText value="#{cont.EMail}" />
                    </p:column>

                    <p:column headerText="Arnes ID" sortBy="#{cont.cont.arnesId}" filterBy="#{cont.cont.arnesId}" filterMatchMode="contains">
                        <h:outputText value="#{cont.arnesId}" />
                    </p:column>    

                    <p:column style="width:95px;" >
                        <p:commandButton oncomplete="cDialog.show()" action="#{contactsBean.setSelectedContact(cont)}" icon="ui-icon-search" title="Podrobno"  update=":cEditForm" /> 
                        <p:commandButton oncomplete="cDialog.show()" action="#{contactsBean.editContact(cont)}" icon="ui-icon-pencil" title="Uredi" update=":cEditForm" style="margin-left:5px;" />
                        <p:commandButton oncomplete="deleteDialog.show()" action="#{contactsBean.setSelectedContact(cont)}" update=":deleteContactForm" title="Izbriši" icon="ui-icon-trash" style="margin-left:5px;" />  
                    </p:column>

                </p:dataTable>

Here it works (on different page): 在这里工作(在不同页面上):

<p:dataTable emptyMessage="Ni zapisov" id="dataTable" var="org" value="#{organizationBean.orgDataModel}"
                     paginator="true" rows="20" rowKey="#{org.idOrganization}"  paginatorPosition="bottom" rowsPerPageTemplate="10,20,30" 
                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"  
                     lazy="true" style="width:100%" sortBy="org.name" sortOrder="ASCENDING" filterDelay="400">

                    <p:column headerText="Ime organizacije" filterBy="#{org.org.name}" filterMatchMode="contains" sortBy="org.name" style="width:435px;" >
                         <h:outputText value="#{(org.name.length()>70)? org.name.substring(0,70).concat('...') : org.name}" /> 
                    </p:column>

                    <p:column  headerText="Naslov" filterBy="#{org.org.address}" filterMatchMode="contains"  sortBy="org.address" >
                         <h:outputText value="#{org.address}" /> 
                    </p:column>

                    <p:column headerText="Pošta"  sortBy="org.zip.zipId" filterBy="#{org.zipId}" filterMatchMode="contains">
                        <h:outputText value="#{org.zip.zipId} #{org.zip.name} -  #{org.zip.country.idCountry} " />
                    </p:column>

                    <p:column style="width:95px;" > 

                        <p:commandButton oncomplete="orgDialog.show()" action="#{organizationBean.setSelectedOrg(org)}" icon="ui-icon-search" title="Podrobno"  update=":orgEditForm" /> 
                        <p:commandButton oncomplete="orgDialog.show()" action="#{organizationBean.editOrg(org)}" icon="ui-icon-pencil" title="Uredi" update=":orgEditForm" style="margin-left:5px;" />
                        <p:commandButton oncomplete="deleteDialog.show()" action="#{organizationBean.setSelectedOrg(org)}" update=":deleteOrgForm" title="Izbriši" icon="ui-icon-trash" style="margin-left:5px;" />  

                    </p:column> 

Visual presentation: 视觉呈现:

http://i57.tinypic.com/25hfpg8.jpg (not seeing arrows) http://i57.tinypic.com/25hfpg8.jpg (看不到箭头)

http://i57.tinypic.com/290zmn6.jpg (working) http://i57.tinypic.com/290zmn6.jpg (正在运行)

So, I want to be able to sort "Oseba" column 因此,我希望能够对“ Oseba”列进行排序

double variable (and wrong attribute name "sort y By"): 双变量(错误的属性名称“ sort y By”):

sortyBy="#{cont.cont.firstName}"

if you are using PF < 4.0 如果您使用的PF <4.0

sortBy="#{cont.firstName}"

else 其他

sortBy="firstName"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM