The following JavaScript function hides the sort arrow (up or down) from the <p:dataTable>
header whose id is discountStartDate
function removeSortableIconCSS()
{
$('#form\\:dataTable\\:discountStartDate .ui-sortable-column-icon').css({"display":"none"});
}
$(document).ready(removeSortableIconCSS);
It turns the column header from,
to the following.
The sort arrow is removed.
After updating the <p:dataTable>
using the following <p:commandButton>
,
<p:remoteCommand name="updateTable" update="dataTable"/>
<p:commandButton id="btnSubmit" actionListener="#{bean.insert}" value="Save"
oncomplete="if(!args.validationFailed) {updateTable();} removeSortableIconCSS();"/>
<p:dataTable id="dataTable" var="row" value="#{discountManagedBean}"...>
...
<p:column id="discountStartDate" sortBy="#{row.discountStartDate}" width="200">
...
</p:column>
...
</p:dataTable>
however, it doesn't work even though the JavaScript function removeSortableIconCSS()
is invoked on the oncomplete
event of <p:commandButton>
and the sort icon appears as in the first image (as soon as the AJAX request is completed and the <p:dataTable>
is updated).
It is not an actual requirement. It is just a demonstration of the problem that happens somewhere else and needs to be tackled.