Change the Locale and Language of the Bootfaces DataTable

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 06:22:00

As Bonifacio mentioned, the DataTable widget of BootsFaces 0.8.x is still in its infancy. Currently, we're working hard to bring you all the features you need - internationalization included. Maybe you want to watch the discussion on our bug tracker (https://github.com/TheCoder4eu/BootsFaces-OSP/issues/301).

By the way, it's surprisingly simple to replace the BootsFaces dataTable by standard JSF 2.x code and a few lines of JavaScript:

<h:dataTable value="{{carPool.carPool}}" var="car" id="carPool" styleClass="table table-striped table-bordered"
  style="width:100%">
  <h:column>
    <f:facet name="header">
      <h:outputText value="Brand" />
    </f:facet>
    <h:outputText value="#{car.brand}" />
  </h:column>
  <h:column>
    <f:facet name="header">
      <h:outputText value="Type" />
    </f:facet>
    <h:inputText value="#{car.type}" />
  </h:column>
</h:dataTable>
<script>
$(document).ready(function() {
$('#carPool').DataTable({
   "language": {
       "url": "//cdn.datatables.net/plug-ins/1.10.10/i18n/Spanish.json"
   }
 });
} );
</script>

I did this in the most examples of http://www.bootsfaces.net/forms/DataTable.jsf. You'll find the source code here: pure HTML and JSF 2.x. As a third alternative, you can construct the HTML code using ui:repeat.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!