我有一個帶有 2 列的簡單惰性數(shù)據(jù)模型。第二列只有默認禁用的復選框(無法單擊它們)。在行選擇上,我只想啟用復選框(checkbox.disabled = false)而不調(diào)用load方法 - 因為我的數(shù)據(jù)沒有更改,因此無需請求數(shù)據(jù)庫。問題是,當我更新我的 dataTable 以將 checkbox.disabled 更改為false,然后調(diào)用 RENDER_PHASE 并調(diào)用load方法,另一方面,如果我不更新我的數(shù)據(jù)表,則該復選框始終被禁用。我怎樣才能讓它一起工作?更新:<h:form id="form-id"> <p:dataTable var="element" id="data-table-id" value="#{view.elements}" lazy="true" paginator="true" paginatorTemplate="{RowsPerPageDropdown} {FirstPageLink} {PreviousPageLink} {CurrentPageReport} {NextPageLink} {LastPageLink}" selectionMode="single" rows="5" rowsPerPageTemplate="5,10,15,30" selection="#{view.selectedElement}"> <p:ajax event="rowSelect" listener="#{view.someMethod()}" update="checkbox"/> <p:column headerText="Element" width="300"> <h:outputText value="#{element.name}"/> </p:column> <p:column headerText="Active" width="300"> <p:selectBooleanCheckbox id="checkbox" disabled="#{view.selectedElement.id ne element.id}" value="#{element.active}"/> </p:column> </p:dataTable> </h:form>當我把update="form-id"然后活動復選框啟用 - 但正如我所說,該load方法被調(diào)用,這是不受歡迎的行為
JSF,Primefaces LazyDataModel - 更新行而不調(diào)用加載方法
ibeautiful
2022-06-15 10:39:53