Quantcast
Channel: Free community support — DataTables forums
Viewing all articles
Browse latest Browse all 35272

Performance issue after get data from AJAX

$
0
0

I have a datatable below that get the data from ajax and read by columns data method :
if I have 3 objects return from ajax , the below comment "test run times" should be log "count"
for 3 times for one process , but I got the log from console which show

(3)count

count

(3)count

(3)count

(3)count

That means this datatable will show after do 5 times duplicate same thing(the secound log not run for 3 times?) and cause the performance issue,
how to figure out this problems? I have no idea which function will trigger 5 times for this process?
Any help will be appreciate!

table =
$('#game_info_list').dataTable({

       "ajax": {
                "url": default_url,
                "dataSrc": "data_list",

                "type":'GET',
                "data": function(data){
                        return {game_group_id_list:$.cookie("show_list")};
                    },
                "columns": [

              { "data":
                  function(d){
                       //test run times
                           console.log("count");
                    var s_t_img = '<img src="/assets/images/'+d.sport_type_key+'.png">'
                    return s_t_img+d.game_group_id_game_group_name;

                }},
              { "data":
                  function(d){
                  //var dt = new Date(d.startDateTime)
                  var dt = new Date(d.startDateTime.replace(/-/g, "/"));
                  var play_time = $.formatDateTime('mm/dd <br> hh:ii', dt)

                  return '<strong>'+play_time+'</strong>'
                }}
            ]

Viewing all articles
Browse latest Browse all 35272

Trending Articles