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

Maintain auto-populated list of filters when using multi_select_custom_func #178

Closed
bdunsmuir opened this issue Mar 27, 2015 · 18 comments
Closed

Comments

@bdunsmuir
Copy link

If you use the multi_select_custom_func to make a custom filter selector, the selection list is no longer populated with all the possible values for that column.

It would be nice to add a custom filter to the list, but still have the list populate with all the other possible values.

vedmack added a commit that referenced this issue Mar 28, 2015
filter in column  based on data in other column/s

#178
#179
@vedmack
Copy link
Owner

vedmack commented Mar 28, 2015

You can use the append_data_to_table_data for that

@vedmack vedmack closed this as completed Mar 28, 2015
@bdunsmuir
Copy link
Author

Daniel, it doesn't appear to be working for me. I am only getting the values I put in the data array. Here is my code:

{column_number : hold_index,
        select_type:'select2',
        filter_type: "multi_select_custom_func",
        filter_match_mode: 'exact',
        custom_func: hold_code_filters,
        data: [   
          {value: 'Exclude On Hold', label: 'Exclude On Hold'},
          {value: 'On Hold Only', label: 'On Hold Only'},
        ],
        append_data_to_table_data: true,
        filter_default_label:'All'
        },

@vedmack
Copy link
Owner

vedmack commented Mar 30, 2015

Are you using the latest beta version? if yes, please provide a jsbin / jsfiddle

@bdunsmuir
Copy link
Author

Is there an existing jsfiddle I can edit? I couldn't post all of what I have and I'm not really sure how to setup a jsfiddle with all of the required files.

I am using the new beta version. The new custom_func() is working well with rowValues

@vedmack
Copy link
Owner

vedmack commented Mar 30, 2015

You can modify the following jsbin

@bdunsmuir
Copy link
Author

Not sure what I'm doing wrong here, but I can't get a jsbin to work at all. Maybe select2 is not available in jsbin. I'm a novice programmer.

http://jsbin.com/cuyirevufo/2/edit?js,output

@vedmack
Copy link
Owner

vedmack commented Mar 31, 2015

added fix to yadcf so grab the latest beta version and fixed your example

@bdunsmuir
Copy link
Author

Still can't get it to work. I tried copying everything directly to my code and no luck.
I made sure I am using the newest beta version.
I am using ajax to populate my table, not sure if that makes a difference.

Everything else works and I get no error messages in the console.
I assume it is just not seeing any existing values in my columns?

@vedmack
Copy link
Owner

vedmack commented Mar 31, 2015

Since it does work fine in the jsbin, I wont be able to help you more without a live sample with your issue

@bdunsmuir
Copy link
Author

I've managed to make a live example that shows the problem. I think it must be something to do with the ajax.

I had to email you the ajax file as I wasn't sure how to host it on jsbin. Here is the JSBIN
http://jsbin.com/weluwewafu/1/edit?html,js,output

@bdunsmuir
Copy link
Author

I am getting a jquery error. Try this jsbin, I think I have correctly linked to the new beta release. http://jsbin.com/gikulu/1/edit?html,js,console,output

Also, is it possible to use the sort options to put the grouped selections at the top of the list? Like prepend them instead of append them?

I know this is a real PITA, but thank you for such a great plugin.

@vedmack
Copy link
Owner

vedmack commented Apr 1, 2015

it will take me some time to fix it properly for ajax too... I'll update this issue when I'll finish this one

@vedmack vedmack reopened this Apr 1, 2015
vedmack added a commit that referenced this issue Apr 2, 2015
@vedmack
Copy link
Owner

vedmack commented Apr 2, 2015

should work now, try the latest beta...

@vedmack vedmack closed this as completed Apr 2, 2015
@bdunsmuir
Copy link
Author

It is working now, thank you very much!

I tried using sort_order with this but it doesn't do anything. Will it be possible to select a sort order with this, or put the grouped selections at the top of the list? Would you prefer I open another ticket for that?

Once again, thank you for the work on this.

@vedmack
Copy link
Owner

vedmack commented Apr 3, 2015

No need for new issue, I'll abuse this one...

@vedmack
Copy link
Owner

vedmack commented Apr 4, 2015

updated, read updated docs if you want to add your data array before on top of the select use before , if you want it to appear sorted then at least for now you shouldn't use array with value/label but use an array of strings. for sorting array with value/label you should open a new issue and know that it will take some time to be added...

@bdunsmuir
Copy link
Author

This works great, thank you .

@peterjun-md
Copy link

I'm having issues where I can get the myCustomFilterFunction cases working, but when trying to select any of the populated values in that column, it doesn't filter and displays all rows. Also when selecting multiple myCustomFilterFunction cases or a myCustomFilterFunction case and a populated value, I get no rows returned.

Used code from here
https://stackoverflow.com/questions/34089173/yadcf-apply-and-filterring-to-multiple-selections-from-a-json-array

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