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

External link to filtered table #14

Closed
gbalme opened this issue Nov 22, 2013 · 9 comments
Closed

External link to filtered table #14

gbalme opened this issue Nov 22, 2013 · 9 comments

Comments

@gbalme
Copy link

gbalme commented Nov 22, 2013

Hello !

First, thanks for the plugin, it's a great help for me :)

I would like to know how could I pass a parameter that would select the correct data in the table.

Example : I have a datatable with different products, and each product has a category (it's a column of the table). For the moment, the user choose his category from a dropdown list and the table shows only the products of that particular category thanks to your plugin.
Now, I would like to have the same effect, when I click from an external html page, to this specific category link. So I click on the category link, and I fall on the datatable already filtered on that category (so the category is already selected in the dropdown list).

Sorry for my bad english, but I hope you understood my question :)

Thanks a lot !

@vedmack
Copy link
Owner

vedmack commented Nov 23, 2013

You are welcome.
There is no way to do so right now, but I will think of something... maybe providing a way to trigger change event in filter...
b.t.w for what kind of a filter type you want this ability?

@gbalme
Copy link
Author

gbalme commented Nov 25, 2013

Thanks it would be awesome !

I specialy need it for the dropdown list filter. So if somebody click on a specific category, then we fall on the table with the category already selected in the dropdown list

@vedmack
Copy link
Owner

vedmack commented Nov 27, 2013

If you use DOM source (and not AJAX source) you can try out a temp release of the 0.4.5 from my showcase I already placed it there and using it too http://yadcf-showcase.appspot.com/multiple_tables.html

src file: http://yadcf-showcase.appspot.com/resources/js/jquery.dataTables.yadcf.js

Because it will take me a few more days to implement it for AJAX source...

vedmack added a commit that referenced this issue Nov 30, 2013
example usage: yadcf.exFilterColumn(oTable, 0, "Some Data 3");
@vedmack
Copy link
Owner

vedmack commented Nov 30, 2013

Ok, feature implemented and documented and working example can be found here :
http://yadcf-showcase.appspot.com/multiple_tables.html

works for both DOM and AJAX source , grab it from master :
https://github.com/vedmack/yadcf/blob/master/jquery.dataTables.yadcf.js

example usage : yadcf.exFilterColumn(oTable, 0, "Some Data 3");

@vedmack vedmack closed this as completed Nov 30, 2013
@gbalme
Copy link
Author

gbalme commented Nov 30, 2013

I don't know why, but it's not working for me :( table not filtered, and select not selected

I'm trying to debug it now, but I'm quite bad with js

Looks like this is the problem : TypeError: Cannot read property 'filter_type' of undefined on line 1069

my select is in a filter_container, could it be the reason ?

@vedmack
Copy link
Owner

vedmack commented Nov 30, 2013

I tested it with filter_container_id and it works just fine, so it must be something else, please post your datatables init/constructor code, jsfiddle or a complete example will be even better

@vedmack vedmack reopened this Nov 30, 2013
@gbalme
Copy link
Author

gbalme commented Nov 30, 2013

$(document).ready(function() {
var oTable = $('#tableau').dataTable( {
"aaSorting": [[ 1, "asc" ]],
"iDisplayLength": 999,
"sDom": 'rt',
"aoColumns": [
{ "sWidth": "5%", "bSortable": false },
null,
null,
{ "bSortable": false },
{"sType": "currency"},
null,
null,
null
]}).yadcf([
{column_number : 2, column_data_type: "html", html_data_type: "text", filter_default_label: "Toutes les marques...", filter_container_id: "external_filter_container"},
{column_number : 6, filter_default_label: "Type de soin...", filter_container_id: "external_filter_container2"},
]);
yadcf.exFilterColumn(oTable, 6, "Masques");
});

I don't know what is jsfiddle sorry

I can give you the link to my website by private msg if you want ?

@vedmack
Copy link
Owner

vedmack commented Nov 30, 2013

send me the url to vedmack@gmail.com, cause the code looks fine...

vedmack added a commit that referenced this issue Nov 30, 2013
example usage: yadcf.exFilterColumn(oTable, 0, "Some Data 3");
@vedmack
Copy link
Owner

vedmack commented Nov 30, 2013

should work now...

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

2 participants