ColVis is not removing rows from table.

ColVis is not removing rows from table.

prabhakarprabhakar Posts: 3Questions: 1Answers: 0
edited March 2015 in Free community support

Hello,

I am using datatables with ColVis extension. My tables data is loaded from the server. When I click on show/hide columns button
the unchecked column is being removed but the corresponding rows are not removed.
Lets say, if I click on all checkboxes, in that case all the columns are hidden but all the rows are still there in the table without headers or column names.

Also sometimes, when I click on column1 to hide it is being hidden but its corresponding row data is being displayed in its next column correspondingly the next column data is being interchanged its place.

I AM FACING THIS PROBLEM AFTER CHANGING THE DATE FROM DATE PICKER!.
UPON INITIAL LOADING THE BROWSER, IT IS WORKING. ONLY WHEN THE DATE IS CHANGED FROM DATE PICKER AND BROWSER REFRESH.

Please help me to fix this.

CODE:

            $('#example').dataTable( {
             "dom": 'C>"clear"<lfrtip',
               searching:false,
               paging:false, 
            "bServerSide": true,
            "sAjaxSource": '/examples/data.txt',
             "deferLoading": true,
             bDeferRender: true,
           "fnServerData": function ( sSource, aoData, fnCallback ) 
            $.getJSON( sSource, aoData, function (json) {
                  fnCallback(json)
                  }   );
             }
         } );

TABLE

           <div class="table-success">
             <table id ="example" class="table table-bordered">
              <thead>
                <tr>
                  <th>Merchant</th>
                 <th>Bank Name</th>
                  <th>Payment Gateway</th>
                   <th>Status</th>
                   <th>Amount</th>
                  <th>Discount</th>
                  <th>Additional Charges</th>
                   <th>Added On</th>
               </tr>
              </thead>
              <tbody id="details">
                <% @all_settlement_details.each do |sd| %>
               <tr>
                   <td><%= sd.merchantname %></td>
                  <td><%= sd.bank_name  %></td>
                <td><%= sd.payment_gateway %></td>
                <td><%= get_status(sd.status) %></td>
                 <td><%= sd.amount %></td>
                <td><%= sd.discount %></td>
                <td><%= sd.additional_charges%></td>
               <td><%= get_added_on_date sd.addedon %></td>
              </tr>
               <% end %>
             </tbody>
           </table>

Basically the data from the table is not been removed or hidden upon clicking on Colvs Checkboxes.
Please see the problem with images here.

http://stackoverflow.com/q/29080103/3423992

Answers

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin
    edited March 2015

    Sounds like a problem with the server-side script. Can you link to the page in question so we can debug it please.

    One other thing - try removing "deferLoading": true, and see if that helps.

    Allan

  • prabhakarprabhakar Posts: 3Questions: 1Answers: 0

    I removed the "deferLoading": true . Still it is same.
    I tested this with some static data. Upon loading there is some data. In that case it is working fine.
    Second Case: when I load my browser initially there is no data. Now I select a date picker to display the transactions which are done during some date(Based on date picker selection.) in this case it is not removing the rows, am not sure why.
    Is this because the data tables storing the session/cookies only upon the browser load(First time?).

    I hope you got my problem.
    Please let me know what else you need to understand this isse.

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    Yes I think I understand the problem. Unfortunately I also think I would need to be able to use the page to be able to debug the issue and help resolve it.

    Allan

  • prabhakarprabhakar Posts: 3Questions: 1Answers: 0

    Hi, Allan.

    In that case please let me know, what else I should provide in the post so that you can help me fix this issue.

    Thank you!

  • allanallan Posts: 63,678Questions: 1Answers: 10,497 Site admin

    A link to the page please, as I requested. I would need to be able to actually see the problem so I can debug it.

    Allan

This discussion has been closed.