The datatable column content function is not reapplied after edit

jQuery UI Widgets
Post Reply
Posts: 1
Joined: 28 Nov 2017, 02:10

28 Nov 2017, 05:11

I have a content function defined on one of my editable columns in a DataTable. When I finish editing, the content function is not reapplied. If I sort any column after the edit the content function is reapplied. Is there a way I can call the content function? Perhaps after some kind of onEditCompleted event if it exists. Also, is there a way to customize the editor in the cell so that I can use a textarea instead of an input text box? Perhaps with some kind of editContent function? Thanks.

Code: Select all

    field: "Notes",
    headerText: "Release Notes",
    content: function (p) {
        var h = "";
        p.Notes.split("\n").forEach(function(note) {
            if (note) h += "<li>" + note + "</li>";
        return $("<ul>" + h + "</ul>");
    editor: "input",
    sortable: false

Posts: 20
Joined: 11 Aug 2018, 11:20

15 Aug 2018, 11:23

First, there is an open ticket in PrimeFaces Issue Tracker, which points to this question, but was recently labeled "will not be corrected."
However, I found a good solution. The PrimeFaces table classification can be activated by calling an undocumented JavaScript method in the data table widget. The following may not work for future versions of PrimeFaces, but it does for 3.4.2:

Just add the following to your component, which activates the update:

oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('sortColumnId')}')), 'ASCENDING')"

<p:dataTable id="myTable"

<p:column id="price" sortBy="#{article.price}">
<f:facet name="header">
<h:outputText value="Price" />
<h:outputText value="#{article.price}" />


Update table work like this
<p:commandButton value="refresh" action="#{tableController.refreshPrices}" update="myTable" oncomplete="myTableWidget.sort($(PrimeFaces.escapeClientId('#{p:component('price')}')), 'ASCENDING')" />

Post Reply

Return to “PrimeUI”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest