Primefaces commandLink需要时间

时间:2015-02-24 14:52:23

标签: primefaces commandlink

我有以下dataTable

<p:dataTable id="viewTicketsDataTable"
    styleClass="inventoryDataTable viewTicketsTable"
    value="#{viewTicketsBean.invbean.inventoryModel.getUiTicketList()}"
    var="viewTickets" 
    frame="hsides" 
    widgetVar="viewTicketsDataTable"
    lazy="true" 
    resizableColumns="true" 
    scrollable="true"
    scrollHeight="540" 
    scrollRows="30" 
    sortOrder="ASCENDING" 
    sortBy="#{viewTickets.id}"
    rowKey="#{viewTickets.id}"
    emptyMessage="#{viewTicketsBean.invbean.inventoryModel.emptyStatusMessage}"
    rowIndexVar="rowIndex" >
        <p:ajax id="sortEventId" event="sort" listener="#{sortBean.sort}"
            update="#{updateSorting}"
            onstart="#{onStartSorting}"
            oncomplete="#{onCompleteSorting}"/>  

        <p:columns  id ="dtColId" 
            value="#{customizeColBean.invbean.inventoryModel.dataTableColumns}" 
            var="column" columnIndexVar="colIndex" sortBy="#{column.sortKey}" >                 
                <f:facet name="header">#{column.header}</f:facet>
                    **<p:commandLink styleClass="ticketCls toolTipCls servIdLink" 
                        value="#{viewTickets.id}" rendered="#{column.property eq 'id'}" onstart="openDetailsPopup()"
                        oncomplete="callContacts();" >
                        <f:setPropertyActionListener target="#{repairTicketDetailsBean.selectedticketHistory}" value="#{viewTickets}" />
                    </p:commandLink>**

                    <h:outputText value="#{viewTickets[column.property]}"
                        rendered="#{column.property eq 'serviceType' or column.property eq 'serviceId'  
                            or column.property eq 'originId' 
                            or column.property eq 'customName' 
                            or column.property eq 'trackingNumber' 
                            or column.property eq 'deviceName' 
                            or column.property eq 'location'
                            or column.property eq 'ticketCreatedDateCorrected'}" />
                    <h:outputText styleClass="detailedStatusCls" value="#{viewTickets[column.property]}"
                              rendered="#{column.property eq 'detailedStatus'}" />
                    <h:outputText styleClass="ticketLastModifiedCorrectedCls" value="#{viewTickets[column.property]}"
                              rendered="#{column.property eq 'ticketLastModifiedCorrected'}" />

        </p:columns>

        <p:column styleClass="ctl_hide">
            <h:outputText styleClass="lastLogEntryTextCls" value="#{viewTickets.lastLogEntryText}" />
        </p:column>
        <p:column styleClass="ctl_hide" >
            <h:outputText styleClass="descriptionCls" value="#{viewTickets.desc}" />
        </p:column>
</p:dataTable>

在这里我有第一列作为commandLink。点击此链接后,我正在打开一个对话框,并且我正在使用p:commandLink进行两次ajax调用。

这里的问题是oncomplete函数需要很长时间才能完成,因此我的下一个ajax调用无法被触发(在callContacts javascript方法中触发)。当我有500行数据时,oncompleted似乎更快,但是当我有大约3000行数据时,它需要时间。 有人可以解释一下为什么需要时间来完成吗?

我尝试了另外一件事

<p:commandLink styleClass="ticketCls toolTipCls servIdLink" 
      value="#{viewTickets.id}" rendered="#{column.property eq 'id'}"
      onstart="#{loadTicketDetailsOnstart}openDetailsPopup()"
      oncomplete="#{loadTicketDetailsOncomplete}setRowIndex(#{rowIndex+1});callContacts();removeTicketDtlsBlockUI();"
      partialSubmit="true" async="true" process="@this">
   <f:setPropertyActionListener target="#{repairTicketDetailsBean.selectedticketHistory}" value="#{viewTickets}" />
</p:commandLink>

我在其中创建了partialSubmit = true和process = @ this,之后它减少了第一次点击任何链接的时间。任何后续链接仍然需要一些时间。你能帮助这里发生什么事吗?

注意:第一种情况下的时间大于15秒,第二种情况下第一次是5秒,后续点击链接则是10到15秒。

以下是我的callContacts方法

function callContacts(){
        alert('first')
        var jQcontactsLoadedCls = jQ(".contactsLoadedCls").val();
        console.log('jQcontactsLoadedCls called!! ' + jQcontactsLoadedCls)
        //if condition is added for create ticket where already contacts are loaded
        if(jQcontactsLoadedCls=='false'){

            jQ('.titleTktIdCls').text("");
            jQ('.titleServiceIdCls').text("");
            jQ('.lblServiceTypeCls').text("");
            jQ('.lblStatusCls').text("");
            jQ('.lblServiceTypeCls').text("");
            jQ('.lblCreatedCls').text("");
            jQ('.lblCreatedCls').text("");
            var jQticketDetailsCL = jQ('.ticketDetailsCL'); 
            jQ(jQticketDetailsCL).click();              
        }else{
            PF('circuitTestdetailsModalDialogWVar').show();
            loadTicketDetailsWindow("undefined")

            PF("repairTab").select(0);
        }

 <p:panel id="ticketDetailsMainPanel" styleClass="ticketDetailsMainPanel">
    <p:tabView  widgetVar="repairTab" class="CktTestPopupTab">          
        <p:tab title="Ticket Details" rendered="#{repairTicketDetailsBean.ticketDetailsForSid.configFlag == false}">            
            <ui:include src="ticketDetailsTab.xhtml" ></ui:include>                 
        </p:tab>

        <p:tab title="Change Details" rendered="#{repairTicketDetailsBean.ticketDetailsForSid.configFlag == true}">         
            <ui:include src="configDetailsTab.xhtml" ></ui:include>          
        </p:tab>

        <p:tab title="Work Log" >
            <ui:include src="workLogTab.xhtml" ></ui:include>
        </p:tab>

        <p:tab title="On Site Contact" rendered="#{repairTicketDetailsBean.ticketDetailsForSid.configFlag == false}">
             <ui:include src="onSiteContactTab.xhtml" ></ui:include>
        </p:tab>

        <p:tab title="Ticket Contacts" >
            <ui:include src="ticketContactsTab.xhtml" >
                <ui:param name="dafaultPrimaryContact" value="#{repairTicketDetailsBean.defaultPrimaryContactName}" />
                <ui:param name="dafaultSecondaryContact" value="#{repairTicketDetailsBean.defaultSecondaryContactName}" />
                <ui:param name="contactFlow" value="ticketDetails" />
            </ui:include>
        </p:tab>

        <p:tab title="Attachments" >
           <ui:include src="attachmentsTab.xhtml" >
                <ui:param name="attachmentsFlow" value="ticketDetails" />   
           </ui:include>
        </p:tab>

        <p:tab title="CALNET 3" rendered="#{viewTicketsBean.enterpriseUserType != null and viewTicketsBean.enterpriseUserType eq 'CALNET' and repairTicketDetailsBean.ticketDetailsForSid.configFlag == false}">
           <ui:include src="CalnetInfo.xhtml" ></ui:include>
        </p:tab>

         <p:tab title="Call Details" rendered="#{repairTicketDetailsBean.ticketDetailsForSid.serviceType eq '8XX' or repairTicketDetailsBean.ticketDetailsForSid.serviceType eq 'LD' or repairTicketDetailsBean.ticketDetailsForSid.serviceType eq 'VOIP DID' or repairTicketDetailsBean.ticketDetailsForSid.serviceType eq 'VOIP TN'}">
            <ui:include src="callDetails.xhtml" ></ui:include>  
        </p:tab>    

    </p:tabView>
    <p:blockUI id="sidDetailsBlockUiId" block="circuitTestdetailsModalDialogId">
                <div class="getMore loading-text">
                    <div class="loading-circle"></div>
                    Loading...
                </div>
    </p:blockUI>


    <p:commandLink id="ticketDetailsCL" styleClass="ticketDetailsCL" actionListener="#{repairTicketDetailsBean.getTicketDetails()}" onstart="#{displayInvLoadingScreen}" oncomplete="#{hideInvLoadingScreen}" update="ticketDetailsMainPanel,reqTktClosureBtn" partialSubmit="true" async="true" process="@this"/>


    <p:commandLink id="ticketContactDetails" styleClass="ticketContactDetailsCls" actionListener="#{contactInfoBean.getEnterpriseContactInformation('ticketDetails')}"  update="ticketDetailsMainPanel" partialSubmit="true" async="true" process="@this"/>
    <p:commandLink id="updateContactWorkLog" styleClass="updateContactWorkLogCls" actionListener="#{repairTicketDetailsBean.updateContactInfo()}" onstart="#{displayInvLoadingScreen}" oncomplete="#{hideInvLoadingScreen}loadTicketDetailsWindow(args);" update="ticketDetailsMainPanel" />


    <p:inputText id="statusText" styleClass="statusText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.detailedStatus}"></p:inputText>
    <p:inputText id="tktIdText" styleClass="tktIdText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.id}"></p:inputText>
    <p:inputText id="serviceType" styleClass="serviceType ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.serviceType}"></p:inputText>
    <p:inputText id="createdText" styleClass="createdText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.ticketCreatedDateCorrected}"></p:inputText>
    <p:inputText id="updatedText" styleClass="updatedText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.ticketLastModifiedCorrected}"></p:inputText>
    <p:inputText id="serviceIdText" styleClass="serviceIdText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.serviceId}"></p:inputText>
    <p:inputText id="serviceLocText" styleClass="serviceLocText ctl_hide" value="#{repairTicketDetailsBean.ticketDetailsForSid.location}"></p:inputText>


</p:panel>

所以基本上点击数据表链接我必须打开一个对话框弹出并拨打电话获取将在弹出窗口中显示的详细信息。我在callContacts()方法中放了一个警告。点击链接警报第一次快速进入,但是第一次警报本身需要时间到来之后。

如果我从<p:commandLink id="ticketDetailsCL" styleClass="ticketDetailsCL" actionListener="#{repairTicketDetailsBean.getTicketDetails()}" onstart="#{displayInvLoadingScreen}" oncomplete="#{hideInvLoadingScreen}" update="ticketDetailsMainPanel,reqTktClosureBtn" partialSubmit="true" async="true" process="@this"/>中删除更新,则调用callContacts中的警报会更快地调用

我希望现在很清楚

0 个答案:

没有答案