@@ -141,6 +141,13 @@ class EvoluGrid implements HtmlElementInterface
141141 */
142142 private $ chevronDownClass ;
143143
144+ /**
145+ * If the customLoader is set, this property allows setting a custom loader
146+ *
147+ * @var HtmlElementInterface
148+ */
149+ private $ customLoader ;
150+
144151 /**
145152 * Message to display if no results are shown.
146153 *
@@ -385,6 +392,19 @@ public function setRowEventListeners($rowEventListeners)
385392 return $ this ;
386393 }
387394
395+ /**
396+ * An object generating HTML for the loader.
397+ *
398+ * The generated HTML MUST use
399+ *
400+ * @param HtmlElementInterface $customLoader
401+ * @return $this
402+ */
403+ public function setCustomLoader ($ customLoader ) {
404+ $ this ->customLoader = $ customLoader ;
405+ return $ this ;
406+ }
407+
388408 /**
389409 * @param string $onResultShown
390410 */
@@ -512,12 +532,20 @@ public function toHtml()
512532 }
513533 echo '
514534 <div id=" ' .$ id .'"></div> ' ;
515- if ($ this ->infiniteScroll ) {
516- echo '<div class="ajaxLoader" style="text-align: center; margin-top: 20px; margin-bottom: 20px; display: none;"><img src=" ' .ROOT_URL .'vendor/mouf/html.widgets.evolugrid/img/ajax-loader.gif" alt="ajax-loader"></div> ' ;
535+
536+ /** if the customLoader is set we use it instead of the default one **/
537+ if ($ this ->customLoader ) {
538+ echo '<div class="ajaxLoader"> ' ;
539+ $ this ->customLoader ->toHtml ();
540+ echo '</div> ' ;
517541 } else {
518- echo '<div class="ajaxLoader" style="text-align: center; background-color: black; width: 100%; height: 100%; position: absolute; top: 0; opacity: 0.3"><img src=" ' .ROOT_URL .'vendor/mouf/html.widgets.evolugrid/img/ajax-loader.gif" alt="ajax-loader" style="margin-top: -20px; position: absolute; top: 50%;"></div> ' ;
542+ if ($ this ->infiniteScroll ) {
543+ echo '<div class="ajaxLoader" style="text-align: center; margin-top: 20px; margin-bottom: 20px; display: none;"><img src=" ' .ROOT_URL .'vendor/mouf/html.widgets.evolugrid/img/ajax-loader.gif" alt="ajax-loader"></div> ' ;
544+ } else {
545+ echo '<div class="ajaxLoader" style="text-align: center; background-color: black; width: 100%; height: 100%; position: absolute; top: 0; opacity: 0.3"><img src=" ' .ROOT_URL .'vendor/mouf/html.widgets.evolugrid/img/ajax-loader.gif" alt="ajax-loader" style="margin-top: -20px; position: absolute; top: 50%;"></div> ' ;
546+ }
519547 }
520- echo '</div>
548+ echo '</div>
521549 <script type="text/javascript">
522550 (function($) {
523551 $(document).ready(function() {
0 commit comments