Quantcast
Channel: FixedColumns — DataTables forums
Viewing all articles
Browse latest Browse all 97

select row with fix column not working can not read property repalce of undefined

$
0
0

Hi All,
I am new to data table community,
I am using fix column with select rows with server side implementation,
whenever i select any scrollable column i am able to get row id which i used for page total and column total
but when i select any fixed column in my case it is right side 2 columns it gives error as -
Cannot read property 'replace' of undefined

from my understanding fix column is not able to return particular row id when i click on it,

Error Message -
http://mail.datatables.net/forums/uploads/editor/8q/eoao67zvtu2d.png
http://mail.datatables.net/forums/uploads/editor/ay/puchjb3p8jdu.png

I am using onclick 'tr'to get triggered row value and using following code -

$('#sort_table_id tbody').on('click', 'tr', function ()
{
  var id = this.id;
  var index = $.inArray(id, selected);

  if ( index === -1 )
    selected.push( id );
  else
    selected.splice( index, 1 );

  col_pos_carats = 4;
 
  //get selected row sum
    var get_current_selected_cts        = (table.column( col_pos_carats).visible()  === true  ?
    $(this).find("td:eq("+col_pos_carats+")").html().replace(/\$|,/g, '') : 0);
 
    if($(this).hasClass('selected')) // set from row callback
    {
      selected_cnt            -= +1;
      selected_cts_sum        -= +get_current_select
    }
    else
    {
      selected_cnt            += +1;
      selected_cts_sum        += +get_current_selected_cts;
    }
 
    $('#sum_cts_selected').html(Math.round(selected_cts_sum * 100) / 100);
    $(this).toggleClass('selected');
});

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.


Viewing all articles
Browse latest Browse all 97

Trending Articles