Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ColVis #56

Closed
pcbulai opened this issue Jun 20, 2014 · 7 comments
Closed

Add support for ColVis #56

pcbulai opened this issue Jun 20, 2014 · 7 comments

Comments

@pcbulai
Copy link

pcbulai commented Jun 20, 2014

YADCF currently doesn't support implementation with ColVis plugin, which shows/hides table columns. If on page load ColVis is setted up to hide a certain column, when the user toggles the visibility of that column the filter corresonding to it doesn't show up.

screenshot-from-2014-06-19-15-52-38

screenshot from 2014-06-19 15 59 28

@MounirBennacer
Copy link

how have you managed to get it to works ? i'm struggeling getting it to work with my app
here is a testcase http://codepen.io/anon/pen/alifh

i'm grabbind the data from my database with datatables/js 1.10 using ajax: { url : "myscript.php"}
i'm getting the data just fine, but the yadcf plugin isent showing

mind helping ?

@pcbulai
Copy link
Author

pcbulai commented Jun 21, 2014

@MounirBennacer Wrong MIME type. Use rawgit to add scripts from Github.

http://codepen.io/sloby/pen/eovwK

@vedmack Thanks for your help! I read what the guys from DataTables replied to you and I managed to make it work.

@vedmack
Copy link
Owner

vedmack commented Jun 21, 2014

@sloby please share your solution so other can benefit from it :)
Anyway I might add support for the colvis from yadcf too

@pcbulai
Copy link
Author

pcbulai commented Jun 21, 2014

Well, what I did is kinna dirty. I'm using v1.10 of Datatables so I took advantage of column-visibility event. Here's how my code looks:

var table = $('#datagrid'),
    datatable = table.dataTable({
      // A gazillion lines here
    })
    .yadcf([{
      column_number: 1,
      filter_type: 'text'
    }, {
      column_number: 2,
      filter_type: 'text'
    }, {
      column_number: 3,
      filter_type: 'select',
      select_type: 'chosen'
    }, {
      column_number: 4,
      filter_type: 'text'
    }, {
      column_number: 5,
      filter_type: 'select',
      select_type: 'chosen'
    }, {
      column_number: 7,
      filter_type: 'text'
    }, {
      column_number: 6,
      filter_type: 'date'
    }]);
  // Since I toggle columns visibility with ColVis I can listen to what column is being hidden or shown
  table.on('column-visibility.dt', function (e, settings, column, state) {
    if (state === true) { // If the column is visible
      datatable.yadcf([{
        column_number: column, // column = column number
        filter_type: 'text'
      }]);
    }
  });

@MounirBennacer
Copy link

thx for the answer, unfortunatly it is not working at all, i've followed every bit of code but i'm not getting the input in the table headers
in fact, i'm using metronic for the layout, maybe bootstrap overwrite this and did not display it, have you encountered this issue ? the input not showing

thx

@vedmack
Copy link
Owner

vedmack commented Jun 22, 2014

@MounirBennacer , please use github issue tracker for concrete bugs/ feature request and google groups for general questions, @sloby forked your test case and used rawgit to include the resources and all looks well. so please provide a proper testcase and post a question in google groups

@vedmack
Copy link
Owner

vedmack commented Jul 20, 2014

Done, you can grab it from https://github.com/vedmack/yadcf/blob/master/lab/jquery.dataTables.yadcf.js 0.8.1.beta

@vedmack vedmack closed this as completed Jul 20, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants