My column with bVisible:false shows up randomly

My column with bVisible:false shows up randomly

vamshi4001vamshi4001 Posts: 5Questions: 0Answers: 0
edited November 2013 in General
I am having 3 columns with different numbers, I actually want to sort based on sum of these 3 columns. I haven't found a method to do so in datatables directly. So I used a 4th column which is a sum of these 3 columns. I had set it with bVisible:false and sorted based on it.

[code]"aoColumns": [
{ "mData": "team_id","sWidth": "10%" },
{ "mData": "team_name","sWidth": "30%" },
{ "mData": "team_twittercount","sWidth": "20%" },
{ "mData": "team_facebookcount","sWidth": "20%" },
{ "mData": "team_fb_talking_about_count","sWidth": "20%" },
{ "mData": "team_totalcount","bVisible" :false}
],
"aaSorting": [ [5,'desc'] ][/code]

but, randomly while repainting the datatable.. I am seeing this invisible column without column header. When ever thi shows up, the sorting doesn't happen. Can anyone please help at the earliest. Thanks in advance.

Check the issue on http://98.248.223.61/sfg/
Click on different items on sports list on left side - you may see it happening on 3rd or 4th selection.

Replies

  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    When you construct the table, do you have 6 columns in the thead?

    You are destroying the table each time - it would be for more efficient, and probably more reliable to use the fnReloadAjax plugin to reload the data.

    Allan
  • vamshi4001vamshi4001 Posts: 5Questions: 0Answers: 0
    Yes, I've kept 6 column names in thead - I was able to reproduce same thing without that column in thead. please let me know if you could find reason/fix for this. Thanks

    Will use fnReloadAjax plugin.
  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    I've just tried it again and haven't been able to reproduce the error at all this morning. Have you made changes to it?

    Nice idea for a site bit :-)

    Allan
  • vamshi4001vamshi4001 Posts: 5Questions: 0Answers: 0
    Thanks allan for suggesting previous changes. After using fnReloadAjax plugin, I was able to solve the issue. Now I've to figure out a way to show the loading gif icon while the data is reloading.

    Thanks :)
  • vamshi4001vamshi4001 Posts: 5Questions: 0Answers: 0
    I am unable to get a loading gif icon on initial load or fnReloadAjax call...

    [code]
    var oTable = $('#dtable').dataTable({
    "bLengthChange": false,
    "bAutoWidth": false,
    "bDestroy":true,
    "sAjaxSource":url,
    "sPaginationType": "bootstrap",
    //"bPaginate": false,
    //"bScrollInfinite": true,
    "aoColumns": [
    { "mData": "team_id","sWidth": "10%" },
    { "mData": "team_name","sWidth": "30%" },
    { "mData": "team_twittercount","sWidth": "20%" },
    { "mData": "team_facebookcount","sWidth": "20%" },
    { "mData": "team_fb_talking_about_count","sWidth": "20%" },
    { "mData": "team_totalcount","bVisible" :false}
    ],
    "oLanguage": {
    "sProcessing": ""
    },[/code]

    but I just see a text "Loading" initially and couldnot see anything while data is populated using fnReloadAjax. Is there a way to show loading gif as it serves as a great feedback to understand that some data is loading?
  • vamshi4001vamshi4001 Posts: 5Questions: 0Answers: 0
    ok.. we need to have bProcessing:true I guess..
  • allanallan Posts: 63,540Questions: 1Answers: 10,476 Site admin
    Yup - the processing element is disabled by default :-)

    Allan
This discussion has been closed.