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

Feature Request: Passing additional options to underlying dataTables object #16

Closed
anoroozian opened this issue Sep 6, 2016 · 3 comments

Comments

@anoroozian
Copy link

I would like to pass on additional options to the underlying dataTables object, for example dynamically hide columns by making a call like this:

bibtexify("somefile.bib", "pubTable", {"columnDefs": [{"visible": false, "targets": [1]}]});

However the additional options are not passed on to the underlying dataTables object. See:
https://github.com/vkaravir/bib-publication-list/blob/master/src/bib-publication-list.js#L259

Do you have any specific reasons for not passing any 'user-provided' options further down the call chain? It is possible to do something like this for example (assuming user_options holds my custom options):

var table = this.$pubTable.dataTable($.extend({}, { 'aaData': bibentries,
            'aaSorting': this.options.sorting,
            'aoColumns': [ { "sTitle": "Year" },
                { "sTitle": "Type", "sType": "type-sort", "asSorting": [ "desc", "asc" ] },
                { "sTitle": "Publication", "bSortable": false }],
            'bPaginate': false
        }, user_options));

Is this something that you could perhaps implement to increase the flexibility of your implementation?

@wmayner
Copy link

wmayner commented Sep 9, 2016

I'd like to sort by year and then month of publication. Not sure exactly how to do that, but this seems like it would help!

@vkaravir
Copy link
Owner

Apologies for the long silence. I just pushed a commit that adds this option. There already was a third optional argument upon initialization, and now you can add datatable there to pass options to datatable library.

For example, to change the sorting order:

bibtexify("#bibtex",
          "pubTable",
          { datatable: { aaSorting: [[0, "asc"], [1, "desc"]] } }
);

@vkaravir
Copy link
Owner

@wmayner: Unfortunately this does not help with sorting by month, as that information is not in the table currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants