PrimeFaces.current().ajax().addCallbackParam("descendantRowKeys", sb.toString()); sb.setLength(0); descendantRowKeys = null;
PrimeFaces.current().ajax().update(infoWindow.getClientId(context));
PrimeFaces.current().ajax().update(infoWindow.getClientId(context));
PrimeFaces.current().ajax().addCallbackParam("descendantRowKeys", sb.toString()); sb.setLength(0); descendantRowKeys = null;
PrimeFaces.current().ajax().addCallbackParam("totalRecords", table.getRowCount());
PrimeFaces.current().ajax().addCallbackParam("totalRecords", filteredData.size());
PrimeFaces.current().ajax().addCallbackParam("totalRecords", lazyModel.getRowCount());
public void filter(FacesContext context, TreeTable tt, List<FilterMeta> filterMetadata, String globalFilterValue) throws IOException { Locale filterLocale = context.getViewRoot().getLocale(); TreeNode root = (TreeNode) tt.getValue(); TreeNode filteredNode = null; tt.getFilteredRowKeys().clear(); findFilteredRowKeys(context, tt, root, filterMetadata, filterLocale, globalFilterValue); filteredNode = createNewNode(root, root.getParent()); List<String> filteredRowKeys = tt.getFilteredRowKeys(); createFilteredNodeFromRowKeys(tt, root, filteredNode, filteredRowKeys); tt.updateFilteredNode(context, filteredNode); tt.setValue(filteredNode); tt.setRowKey(null); //Metadata for callback if (tt.isPaginator()) { PrimeFaces.current().ajax().addCallbackParam("totalRecords", filteredNode.getChildren().size()); } if (tt.getSelectedRowKeysAsString() != null) { PrimeFaces.current().ajax().addCallbackParam("selection", tt.getSelectedRowKeysAsString()); } }
public void loadLazyScrollData(int offset, int rows) { DataModel model = getDataModel(); if(model != null && model instanceof LazyDataModel) { LazyDataModel lazyModel = (LazyDataModel) model; List<?> data = null; if(this.isMultiSort()) { data = lazyModel.load(offset, rows, getMultiSortMeta(), getFilters()); } else { data = lazyModel.load(offset, rows, resolveSortField(), convertSortOrder(), getFilters()); } lazyModel.setPageSize(rows); lazyModel.setWrappedData(data); //Update paginator/livescroller for callback if(ComponentUtils.isRequestSource(this, getFacesContext()) && (this.isPaginator() || isLiveScroll() || isVirtualScroll())) { PrimeFaces.current().ajax().addCallbackParam("totalRecords", lazyModel.getRowCount()); } } }
public void sort(TreeTable tt) { TreeNode root = tt.getValue(); if (root == null) { return; } UIColumn sortColumn = tt.getSortColumn(); if (sortColumn != null && sortColumn.isDynamic()) { ((DynamicColumn) sortColumn).applyStatelessModel(); } ValueExpression sortByVE = tt.getValueExpression("sortBy"); SortOrder sortOrder = SortOrder.valueOf(tt.getSortOrder().toUpperCase(Locale.ENGLISH)); TreeUtils.sortNode(root, new TreeNodeComparator(sortByVE, tt.getVar(), sortOrder, tt.getSortFunction(), tt.isCaseSensitiveSort(), tt.resolveDataLocale())); tt.updateRowKeys(root); String selectedRowKeys = tt.getSelectedRowKeysAsString(); if (selectedRowKeys != null) { PrimeFaces.current().ajax().addCallbackParam("selection", selectedRowKeys); } }
public boolean isTreeNodeDropped() { MethodExpression me = this.getOnDrop(); if(me != null) { FacesContext context = getFacesContext(); Map<String,String> params = context.getExternalContext().getRequestParameterMap(); String clientId = this.getClientId(context); int dndIndex = Integer.parseInt(params.get(clientId + "_dndIndex")); boolean isDroppedNodeCopy = Boolean.valueOf(params.get(clientId + "_isDroppedNodeCopy")); TreeDragDropInfo info; if(this.isMultipleDrag()) info = new TreeDragDropInfo(this, this.getDragNodes(), this.getDropNode(), dndIndex, isDroppedNodeCopy); else info = new TreeDragDropInfo(this, this.getDragNode(), this.getDropNode(), dndIndex, isDroppedNodeCopy); retValOnDrop = (Boolean) me.invoke(context.getELContext(), new Object[] { info }); PrimeFaces.current().ajax().addCallbackParam("access", retValOnDrop); } return retValOnDrop; }
/** * Updates all components with the given clientIds. * * @param clientIds a list of clientIds. */ public void update(Collection<String> clientIds) { if (clientIds == null || clientIds.isEmpty()) { return; } FacesContext facesContext = getFacesContext(); // call SEF to validate if a component with the clientId exists if (facesContext.isProjectStage(ProjectStage.Development)) { for (String clientId : clientIds) { validateClientId(clientId, facesContext); } } facesContext.getPartialViewContext().getRenderIds().addAll(clientIds); }
/** * Updates all components with the given clientIds. * * @param clientIds a list of clientIds. */ public void update(String... clientIds) { if (clientIds == null || clientIds.length == 0) { return; } FacesContext facesContext = getFacesContext(); for (String clientId : clientIds) { if (facesContext.isProjectStage(ProjectStage.Development)) { validateClientId(clientId, facesContext); } facesContext.getPartialViewContext().getRenderIds().add(clientId); } }
/** * Set primefaces validationFailled callback param */ private void validationFailed() { if(isRequestContextOnClasspath()) { org.primefaces.context.RequestContext context = org.primefaces.context.RequestContext.getCurrentInstance(); if(context != null) { context.addCallbackParam("validationFailed", true); } } else { org.primefaces.PrimeFaces pf = org.primefaces.PrimeFaces.current(); if (pf != null) { pf.ajax().addCallbackParam("validationFailed", true); } } }
/** * Set primefaces validationFailled callback param */ private void validationFailed() { if(isRequestContextOnClasspath()) { org.primefaces.context.RequestContext context = org.primefaces.context.RequestContext.getCurrentInstance(); if(context != null) { context.addCallbackParam("validationFailed", true); } } else { org.primefaces.PrimeFaces pf = org.primefaces.PrimeFaces.current(); if (pf != null) { pf.ajax().addCallbackParam("validationFailed", true); } } }
protected void encodeStep(FacesContext context, Wizard wizard) throws IOException { String stepToDisplay = wizard.getStep(); if (!isValueBlank(stepToDisplay)) { UIComponent tabToDisplay = null; for (UIComponent child : wizard.getChildren()) { if (child.getId().equals(stepToDisplay)) { tabToDisplay = child; } } if (tabToDisplay != null) { tabToDisplay.encodeAll(context); } PrimeFaces.current().ajax().addCallbackParam("currentStep", wizard.getStep()); } }
public static void updateComponent(String id) { PrimeFaces.current().ajax().update(findComponentClientId(id)); }
public void loadLazyData() { DataModel model = getDataModel(); if(model != null && model instanceof LazyDataModel) { LazyDataModel lazyModel = (LazyDataModel) model; List<?> data = lazyModel.load(getFirst(), getRows(), null, null, null); lazyModel.setPageSize(getRows()); lazyModel.setWrappedData(data); //Update paginator for callback if(ComponentUtils.isRequestSource(this, getFacesContext()) && this.isPaginator()) { PrimeFaces.current().ajax().addCallbackParam("totalRecords", lazyModel.getRowCount()); } } }
public static void updateComponents(List<String> ids) { List<String> idsComplete = ids.stream().map(id -> findComponentClientId(id)).collect(Collectors.toList()); PrimeFaces.current().ajax().update(idsComplete); }
public void loadLazyData() { DataModel model = getDataModel(); if(model != null && model instanceof LazyDataModel) { LazyDataModel lazyModel = (LazyDataModel) model; List<?> data = lazyModel.load(getFirst(), getRows(), null, null, null); lazyModel.setPageSize(getRows()); lazyModel.setWrappedData(data); //Update paginator for callback if(ComponentUtils.isRequestSource(this, getFacesContext()) && this.isPaginator()) { PrimeFaces.current().ajax().addCallbackParam("totalRecords", lazyModel.getRowCount()); } } }