Datatable responsive not working after ajax call

Datatable responsive not working after ajax call

gonzalobalerogonzalobalero Posts: 2Questions: 1Answers: 0

Hi, i have a datatable but when load data with ajax the responsive doesn´t work.

Here is my code:

HTML:

Codigo Nombre Simbolo OperadoAMonedaNacional CodigoBancoCentral

Javascript:

$.ajax({
type: "POST",
dataType: "json",
url: "Monedas.asmx/GetMonedasListado",
success: function (data) {
var datatableVariable = $('#dataTables-monedas').DataTable({
responsive: true,
bPaginate: true,
bFilter: true,
bInfo: true,
data: data,
columns: [
{ 'data': 'Codigo' },
{ 'data': 'Nombre' },
{ 'data': 'Simbolo' },
{ 'data': 'OperadoAMonedaNacional' },
{ 'data': 'CodigoBancoCentral' }
],
});
}
});

Thanks a lot!
Gonzalo

Answers

  • Tester2017Tester2017 Posts: 145Questions: 23Answers: 17

    Have you downloaded the responsive extension? https://datatables.net/download/index

  • gonzalobalerogonzalobalero Posts: 2Questions: 1Answers: 0

    Hi Tester2017!
    Yes, i download it.
    The issue hapen only when i load data with ajax. I don´t know why...if i put the data in the html table works correctly.

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Happy to take a look at a test page showing the issue so we can help to debug it.

    Allan

  • mikepoolemikepoole Posts: 11Questions: 5Answers: 0

    Has there been any movement on this? I think I am suffering with the same thing

    A pure HTML table on my page is working perfectly with responsive but a table populated by an AJAX call is not

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin

    Can you give me a link to a test case showing the issue please?

    Allan

  • AnandThurubatlaAnandThurubatla Posts: 1Questions: 0Answers: 0

    Responsiveness not working with dtOptions Ajax call. Following is my some part of code:

    this.dtOptions = {
    pagingType: 'simple_numbers',
    pageLength: 10,
    serverSide: true,
    processing:false,
    searching: false,
    responsive: true,
    autoWidth:false,
    retrieve: true,
    destroy: true,
    deferRender: true,
    language: {
    processing: '<i class="fa fa - spinner fa-spin fa-3x fa - fw"></i><span class="sr - only">Loading...</span>'
    },
    order: [[1, 'desc']],
    ajax: (dataTablesParameters: any, callback) => { }
    ::
    ::

    When I review the Angular 6 page in Mobile, datatable is not breaking properly. I am getting (+) icon to expan child rows but not working and columns are not breaking to fit the table into mobile view.

    Any help on this issue?

  • als9xdals9xd Posts: 5Questions: 2Answers: 0

    Any updates on this?

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736

    Any updates on this?

    This post is a year old with a request for a test case showing the issue. I would suggest creating a new thread with your specific information so we can help. And if you can provide a link to your page or a test case that would help even more.
    https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case

    Kevin

  • kthorngrenkthorngren Posts: 20,144Questions: 26Answers: 4,736
  • chetannrchetannr Posts: 1Questions: 0Answers: 0
  • colincolin Posts: 15,112Questions: 1Answers: 2,583

    @chetannr : that sounds like a different issue to the OP. Can you create a new thread and provide a test case demonstrating the problem, please.

This discussion has been closed.