I want to perform a row switch onclick, like in example below. The only way primefaces allow swapping rows is make them draggable, which is not an option to me. Poked it for about a day, no luck. I would appreciate any assistance, thanks! PF version 6.1.
function moveUp(id){
let element = $("tr").find(`[data-ri='${id}']`);
element.prev().before(element);
}
function moveDown(id){
let element = $("tr").find(`[data-ri='${id}']`);
element.next().after(element);
}
<p:dataTable id="prices-table" var="price" value="#{Bean.prices}">
<p:ajax event="rowReorder" listener="#{Bean.onPriceReorder}"
update="prices-table" />
<p:column style="width:16px">
<p:commandButton update="prices-table" onclick="moveUp()">up</p:commandButton>
<p:commandButton update="prices-table" onclick="moveDown()">down</p:commandButton>
</p:column>
<p:column headerText="Title">
<h:outputText value="#{price.title}" />
</p:column>
</p:dataTable>