1

I have tried this code but it works for once but not every time.

$('.rptEmail').attr('data-ignore','true');
$('.rptEmail').attr('data-hide','all');
 $('#ReportMainGrid').trigger('footable_redraw');

I have tried other trigger also but nothing works properly.

Sujith S
  • 67
  • 1
  • 8

3 Answers3

1

I'm surprised no one else has had this problem. After pecking around the code, it looks like the data attributes for the rows are pulled using the .data() jquery function. The problem with this is (from what I understand) the function will populate on initial page load. What this means is, even though you change the data-hide attribute with .attr(), .data() will still hold the old value.

To get around this, without touching the Footable code, you can simply use the .data() function to change the column's property.

$("PATH_TO_TH").data("hide", "all");      //Set this to whatever you'd like
$('.footable').data('footable').reset();
$('.footable').footable();
duckboy81
  • 306
  • 2
  • 13
  • Someone could probably chime in and help me, but you'll notice a difference between .data() and .attr() -- with .data() the attribute is changed in the background of jquery (ie. You won't see it in the DOM editor for the tag you're working on) – duckboy81 Jun 10 '14 at 16:44
1

If you want to use FooTable functions you can do this:

FooTable.get('#FooTable_ID').columns.get(col_id).visible = false;
FooTable.get('#FooTable_ID').draw();

where col_id is the index of the column you want to work with.

0

Sorry to jump in on this very old question but a much simpler method is to call .toggle or .hide/.show via jquery:

$('table td:nth-child(1),th:nth-child(1)').hide();

The above code will hide the header and the associated column rows.

munkee
  • 759
  • 1
  • 9
  • 23
  • Yes as the library did not have a function to do this. No meet to down vote a working solution – munkee Apr 25 '17 at 15:16
  • 2
    The library did have a function to do the required, as you can see in the answer above you. (from 2014) You response is unrelated to the subject, does not solve the issue of the OP and overall confuses people that come to this page at a later time. – Rafael Herscovici Apr 26 '17 at 07:51