How to put image in loading

How to put image in loading

marcio prandomarcio prando Posts: 6Questions: 1Answers: 0

Hello!

I need put one "loading.gif" in the loading of datatable, anyone can help me? How i do this?
I search in various sites but i cannot find... Help mee, please!

Thanks

This question has an accepted answers - jump to answer

Answers

  • AshThorntonAshThornton Posts: 5Questions: 1Answers: 0

    If you're talking about the "Loading..." popup that you see when the table is updating then you can use the language option for the table:

    $('#myTable').DataTable({
      language: {
        processing: "<img src='img/loading.gif'> Loading...",
      }
    });
    
  • marcio prandomarcio prando Posts: 6Questions: 1Answers: 0
    edited February 2016

    Hey! Thanks for your help! Yes, i'm talking about the popup!

    I put the processing: attribute, but i have url also, and processing: not work, if remove url then processing works, can help me ?

    "language": {
                        "url": "//cdn.datatables.net/plug-ins/1.10.9/i18n/Portuguese-Brasil.json",
                        processing: "<img src='{{asset('build/img/jquery.easytree/loading.gif')}}'> Carregando..."
    
                    }
    
  • AshThorntonAshThornton Posts: 5Questions: 1Answers: 0

    Looks like you're trying to add a URL for your data source, which can be done with the ajax option and needs to be added outside of the language option object:

    $('#myTable').dataTable( {
      ajax: "//cdn.datatables.net/plug-ins/1.10.9/i18n/Portuguese-Brasil.json",
      language: {
        processing: "<img src='{{asset('build/img/jquery.easytree/loading.gif')}}'> Carregando..."
      }
    } );
    
  • marcio prandomarcio prando Posts: 6Questions: 1Answers: 0

    Thank you for your help!

    But I already use the ajax option to connect with my data source, this link is about traduction of datatable ...

    My complete script :

     $(function () {
                var pathname = window.location.pathname;
    
                $('#table-produto').DataTable({
                    processing: true,
                    serverSide: true,
                    ajax: {
                        url: '{{route('produtos.datatable')}}',
                        data: {url: pathname}
                    },
    
                    columns: [
                        {data: 'nome', name: 'nome'},
                        {data: 'cod_barras', name: 'cod_barras'},
                        {data: 'vlr_venda', name: 'vlr_venda'},
                        {data: 'action', name: 'Ação', orderable: false, searchable: false}
                    ], "language": {
                        "url": "//cdn.datatables.net/plug-ins/1.10.9/i18n/Portuguese-Brasil.json"
                    }
                });
            });
    
  • allanallan Posts: 61,980Questions: 1Answers: 10,162 Site admin
    Answer ✓

    If your language file were to specify the processing option then that would take priority over your local string. That is a known issue and something I will look into for a future release.

    Allan

  • marcio prandomarcio prando Posts: 6Questions: 1Answers: 0

    Amazing Allan!

    I Will wait the release!

    Thanks for your great job!

  • allanallan Posts: 61,980Questions: 1Answers: 10,162 Site admin

    It might be some months off... I'm not planning on actually implementing that particular feature until the next major version.

    Allan

  • marcio prandomarcio prando Posts: 6Questions: 1Answers: 0

    Ok!

    Thank you anyway!

This discussion has been closed.