Quantcast
Channel: Recent Discussions — DataTables forums
Viewing all articles
Browse latest Browse all 82311

Error datatables requested unknown parameter for row X, column Y when hiding multiple columns

$
0
0

Hi I'm working with a datatable that haves a button which hides a group of columns, i'm also using the responsive extension of datatables, for recalculate the columns width when this changes, the button uses the buttons extension and is defined like this:

{
         extend: 'colvisGroup',
         text: '<b>HIDE MOST</b>',
         hide: function hide(colIdx) {
                  return datatablesMinDisplayColumns.indexOf(colIdx) < 0;
          }
}

datatablesMinDisplayColumns is an array of columns that i will not hide.

The column has a render method, which handles the data null exception, as u can see:

                'render': function (data, type, row) {
                    if (!data)
                        return '<a target="_blank" href="/url">+</a>';
                    else
                        return '<a class="anonymous" href="' + data + '" target="_blank">URL</a>' ;
                }

The problem is when load page if i hit this button the first time will throw this error : datatables requested unknown parameter for row X, column Y pointing to the column with this render method. Then everything will work fine if i hit for the second time. I managed to solve this issue by setting 'defaultContent': '' on this column. But this solution feels like redundant and a work around if i'm already handling this exception. So, i checked the render method doesn't get called when clicking the hide button. So my question is: There can be method trying to get data of a column without calling the render method? This could be related to the responsive plugin i'm using?


Viewing all articles
Browse latest Browse all 82311

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>