Showing processing icon/msg while loading

Showing processing icon/msg while loading

ziv@kpmbro.comziv@kpmbro.com Posts: 73Questions: 28Answers: 4
edited May 2017 in General

Hey Allan :)

i'm trying to show loading indicator while loading.

I tried everything that is commented.

the only thing that half worked was the fnInitComplete but i didnt find an event that indicate on the start of the loading.

but didnt worked.

          $('#table').DataTable({
            dom: 'Bfrtip',
            // fnInitComplete : function() {
            //   alert("loading start");
            // },
            // language: {
            //  "processing": "Loading. Please wait..."
            // },
            // "processing": true,
            buttons: ['csv', 'excel', 'pdf'],
            "footerCallback": function(row, data, start, end, display) {
              var api = this.api();
              api.columns('.sum', {
                page: 'current'
              }).every(function(s) {
                if (s != 2) {
                  var sum = this
                    .data()
                    .reduce(function(a, b) {
                      var x = parseFloat(a) || 0;
                      var y = parseFloat(b) || 0;
                      return Number(x + y).toFixed(2);
                    }, 0);
                }
                $(this.footer()).html(sum);
              });
            }
          });

how can i fix this ?

Thanks :)

Answers

  • allanallan Posts: 63,683Questions: 1Answers: 10,498 Site admin

    i didnt find an event that indicate on the start of the loading.

    The loading happens synchronously with the DataTable initialisation. So it is safe to simply display the loading indicator before you initialise the DataTable.

    Allan

This discussion has been closed.