1

I'm using Primefaces 5.0 and I'm trying to use the "draggableRows" feature. It works fine but I'm trying to get the reordered list in order to save the new position into database.

I tried this implementation: Draggable rows in primefaces datatable - a way to save the order of the table?

Unfortunately, I have no enough reputation to Add a Comment in that question, so I will ask it here:

I tried exactly what the answer said, but <h:outputScript name="js/pf.js" target="body"/> doesn't load.

So, I also tried: <script type="text/javascript" src="js/pf.js"/> Then it loads but tabSort is not defined because it can't get the DataTable's widgetVar.

PS: That question is from 2013. Has Primefaces any new feature to do this stuff more easily?

PS2: All the sources is in the question linked above. My source is exactly the same.

1 Answer 1

0

This code :

<h:outputScript name="js/pf.js" target="body"/>

only works if you have a <h:body> and not just a <body> element in your view.

The other reason why your code may not work is the resource path. See : Include javascript with resources via h:outputScript

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for the answer. I'm using <h:body> instead of <body>. When I inspect my <h:head> element on browser, my js/pf.js doesn't even appear in the code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.