Skip to content

Commit

Permalink
TheCoder4eu/BootsFaces-OSP#853 explaining how to use b:dataTable behi…
Browse files Browse the repository at this point in the history
…nd a firewall
  • Loading branch information
stephanrauh committed Oct 5, 2018
1 parent bfe3f80 commit 8bd78c0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/main/webapp/layout/resourcemanagement.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
<b:navLink href="#dealing_with_resource_files" value="Dealing with resource files" />
<b:navLink href="#jquery_and_jqueryui" value="jQuery and jQueryUI" />
<b:navLink href="#font_awesome" value="Font Awesome" />
<b:navLink href="#configuring_resources_via_the" value="Configuring resources via the" />
<b:navLink href="#configuring_resources_via_the" value="Configuring resources via the web.xml" />
<b:navLink href="#defining_when_your_resource_files_are_loaded" value="Defining when your resource files are loaded" />
<b:navLink href="#datatable" value="Using DataTables behind a firewall" />
</b:listLinks>
</ui:define>

Expand Down Expand Up @@ -57,6 +58,8 @@
<p>Alternatively, you can configure your <code>web.xml</code> to suppress certain resources:</p>
<ul>
<li>Setting the context parameter <code>net.bootsfaces.get_fontawesome_from_cdn</code> to "yes" or "true" allows you to provide your own Font Awesome file.</li>
<li>Setting the context parameter <code>net.bootsfaces.get_datatable_from_cdn</code> to "yes" or "true" allows you to provide your own DataTables.js and dataTables.css
file. Also see the explanation in the section below.</li>
<li>Setting the context parameter <code>net.bootsfaces.get_jquery_from_cdn</code> to "yes" or "true" allows you to provide your own jQuery file.</li>
<li>Setting the context parameter <code>net.bootsfaces.get_jqueryui_from_cdn</code> to "yes" or "true" allows you to provide your own jQueryUI file.</li>
<li>Setting the context parameter <code>net.bootsfaces.get_bootstrap_from_cdn</code> to "yes" or "true" allows you to provide your own Bootstrap CSS file.
Expand All @@ -70,8 +73,22 @@
</li>
</ul>

<h2><a id="datatable">Using &lt;b:dataTable /&gt; behind a restrictive firewall, or how to use your own version of datatables.min.js</a></h2>
<p>There are many reasons to stray away from the way BootsFaces loads the JavaScript and CSS files of it's datatable.
In most cases, it's because of the firewall. Some time ago, we tried to improve both the memory footprint
and the UI performance of BootsFaces by dropping our own copy of the JavaScript and CSS resource files of <code>&lt;b:dataTable /&gt;</code>.
Since version 1.2.0, BootsFaces loads these file from a super-fast CDN. Before long, our friends from LiferayFaces informed us that
this is a no-go in many companies. The firewall doesn't allow to load JS files from outside.</p>
<p>So we follow the same approach you've already seen for jQuery above:</p>
<ul>
<li>Setting the context parameter <code>net.bootsfaces.get_datatable_from_cdn</code> to "yes" or "true" allows you to provide your own DataTables.js and dataTables.css
file. This means it's up to you to add these files in a <code>&lt;script&gt;</code> or <code>&lt;h:outoutScript&gt;</code>.</li>
<li>BootsFaces scans the header, the body, and the form for <code>&lt;h:outputScript library="whatever" name="*datatables*.js /&gt;</code> and
<code>&lt;h:outputStylesheet name="*datatables*.css /&gt;</code>. If it finds something like this, it prevents the corresponding file to be loaded from the CDN.
BootsFaces even ignores the case to give you maximum flexibility.</li>
</ul>

<h2><a id="defining_when_your_resource_files_are_loaded">Defining when your resource files are loaded</a></h2>
<h2><a id="defining_when_your_resource_files_are_loaded">Defining when your resource files are loaded (aka load order)</a></h2>
<p>If you need to place your CSS or JS file before or after the other resource files, you can use the attribute <code>position</code> of the
<code>&lt;h:outputStylesheet /&gt;</code>. This is a non-standard attribute, so chances are your IDE complains about it. If so, make it a pass-through attribute.
</p>
Expand Down

0 comments on commit 8bd78c0

Please sign in to comment.