0

I am using jsf 2.3 and bootstrap 4 in my project. The user should be able to reorder the rows of the table (I do not want to use PF dataTable). I use the following library: https://examples.bootstrap-table.com/#extensions/reorder-rows.html#view-source This work fine with a simple HTML page but in JSF I can not see the attribute (data-show-toggle, data-use-row-attr-func, data-reorderable-rows) in source of the page after it renders.

<h:dataTable value = "#{userData.employees}" var = "employee"     
             TableId="test"      
             data-show-toggle="true"      
             data-use-row-attr-func="true"    
             data-reorderable-rows="true">    
      <h:column>                    
          <f:facet name = "header">Name</f:facet>                   
          #{employee.name}    
      </h:column>    
      <h:column>
          <f:facet name = "header">Age</f:facet>
          #{employee.age}    
     </h:column>     
     <h:column>
           <f:facet name = "header">Salary</f:facet>
            #{employee.salary}    
         </h:column> 
</h:dataTable>

and on load the following JS:

$('#test').bootstrapTable();

I am not sue if it is Ok to add these JS attribute to the JSF table ! Thank you so much in advance

noName
  • 133
  • 1
  • 12
  • what's your issue? Did you include boostrap + jquery + boostrap-table libraries in the source code? Did you run your code when document is ready? Can you add the rendered html table? Is it a table or datatable? – gaetanoM Sep 24 '20 at 21:01
  • the issue ist that the reordering does not work, i add all libraries. In the same page I have a Table and a Datatable. everything is fine with table but in datatable the reordering does not work! – noName Sep 24 '20 at 21:08
  • The 1st duplicate explains how to figure out the client ID of a JSF component for usage in jQuery (note that `TableId` is wrong, you want `id`). The 2nd duplicate explains how to properly set custom attributes such as `data-xxx` on a JSF component. – BalusC Sep 24 '20 at 22:04
  • @BalusC Thank you so much . my prolblems solved with your suggsted duplicates questions – noName Sep 28 '20 at 08:35

0 Answers0