Why table.ajax.url().load() didn't work?

Why table.ajax.url().load() didn't work?

walliwalli Posts: 4Questions: 3Answers: 0
edited September 2014 in Free community support

I really see the server return new data, but the datatable still show the old data.
how can I refresh the datatable?

            var table = $('#questionTable').DataTable({
                "jQueryUI": true,
                "destory": true,
                "ordering": false,
                "searching": false,
                "paging": true,
                "language": {
                   ...
                    }
                },
                "columnDefs": [
                    {"bSearchable": false, "bVisible": false, "aTargets": [0]},
                    {"bSearchable": false, "bVisible": false, "aTargets": [1]},
                    {"bSearchable": false, "bVisible": false, "aTargets": [2]}
                ],
                "processing": false,
                "serverSide": true,
                "ajax": "${context}/question/list.htm",
                "columns": [
                    {"data": "id"},
                    {"data": "userId"},
                    {"data": "time"},
                    {"data": "question"}
                ]
            });

            $('#myQuestion').click(function () {
                if (login()) {
                    var userId = $.cookie("userId");
                    table.ajax.url("${context}/question/my.htm?userId=" + userId).load();
                }
            });

Answers

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    Looks like it should work to me. Please link to a test case showing the issue.

    Allan

  • walliwalli Posts: 4Questions: 3Answers: 0

    Thanks Alian, but I finally found the reason, still thanks

This discussion has been closed.