vedmack / yadcf

Yet Another DataTables Column Filter (yadcf)
http://yadcf-showcase.appspot.com/
MIT License
732 stars 285 forks source link

Select2 freezes multi_select filter in server side processing #184

Closed AlexPowen closed 9 years ago

AlexPowen commented 9 years ago

Hi Daniel,

I have a datatables with yadcf. This is relevant information:

Datatables Version --> 1.10.5 Select2 --> 4.0.0-rc2 jquery.datatables.yadcf.js --> 0.8.8.beta.18 Server Side Processing ---> Yes

This is my live example with server side processing http://datatables.altervista.org/yadcf1/examples/server_side/simple.html

Configuration standard for columns is

filter_type: "text",

BUT If I try to change parameters of column 0 (example) into

filter_type: "multi_select", select_type: 'select2',

select2.js freezes multi_select parameter: http://datatables.altervista.org/yadcf1/examples/server_side/simple2.html

However without _selecttype seems that _multiselect works like Select tag filter because it filtering immediately without permit to add more values at same times

Other thing that doesn't work is parameter : exclude: true

checkbox don't appears on column.

I share you a offline version of live demo + little sql file so you can understand better. you have to change database name/credentials only (look server_processing.php)

http://datatables.altervista.org/yadcf_server_side.zip

index file is yadcf1/examples/server_side/simply.html

vedmack commented 9 years ago

Hi, You are actually using the 0.8.8.beta.11 version , please upgrade to 0.8.8.beta.20 and also grab the latest yadcf css and update me

AlexPowen commented 9 years ago

mmm.. Now yadcf filter boxes appears and css looks better but elements loading remain frozen and paging, sorting & filtering functions are disabled. Processing... never stops

Look here:

http://datatables.altervista.org/yadcf1/examples/server_side/simple3.html

exclude: true checkbox on _columnnumber: 2 does not yet appear

vedmack commented 9 years ago

Tip # 1, never place js code inside html (place it inside js file and include it in html Tip # 2, work atleast with jshint Tip # 3, don't place comma in the last element of object

{
    a: 'value',
    b: 'value' //  <--- no comma here
}

And you have plenty of them in your code, let me know when your code will be valid and you still have issues :)

AlexPowen commented 9 years ago

Ok, I followed your tips and I saw some improvement. Now exclude: true checkbox appears and now multi_select works without freezing. DEMO

BUT.. there are some problems:

1. if I set

filter_type: "multi_select", fselect_type: 'select2', exclude: true

exclude: true checkbox disappears

2. If i try to implementing range_number_slider

column_number: 5, filter_type: "range_number_slider", filter_container_id: "external_filter_container"

css and some functionalities are destroyed. I add a container like this

<body id="yadcf_example"> ..... <div id="external_filter_container"></div> ... <table cellpaddin......

3. Filtering with multi_select not working like OR condition. If you add 2 records with multi_select --> table returns null results and not record1+record2. I try to understand if this is a problem with server side processing filtering or with yadcf library. HERE is related question. Must I set FULL TEXT INDEX on server side for your yadcf?

4. Select2

I don't understand because with select2.min.js _multiselect is working well while with select2.js or select2.full.js it destroy everything.

vedmack commented 9 years ago

1) exclude supported by text filter only (at least for now)

2) I need to see a live sample for that

3) Its a a server side related question in which I can't help too much because I'm not a PHP user , indeed stackoverflow is the place to ask such questions

4) You better use select 3.x version (because the 4.x is not fully supported by yadcf yet)

please, this time don't spam the github issues, if its a question, then ask it on stackoverflow and I will answer it there

AlexPowen commented 9 years ago

Ok, please help me to understand if this is a server side or a yadcf javascript problem because multi_select works strangely:

multii2

and then record is "jumped" into filter I can't add more ones because multi_select can't show me other records list..but why?

multi_2

in javascipt or JAVA code how can you overcome this problem? If this is not possible for filtered list I need to display everytime complete records list from multi_select when I perform a filtering action except when I filter records from multi_select or other yadcf filters to find by default a precise record (yadcf default filters settings).

2. range_number_slider give me please much more time to test better implementation and then I give you a live sample with success or failure.

vedmack commented 9 years ago

The reason that you get Dreams from first page only is because when using server side you need to feed your filters from all available values from the server too , using the yadcf_data_1 / yadcf_data_2 etc... see code snippets in the showcase server_side_source,

regarding the range_number_slider , see also on that same showcase page , you need to send min/max from server

Everything you need is on that showcase page, so please inspect it as much as needed, and in case of further questions please use stackoverflow becuase github is only for bugs / new features request.

AlexPowen commented 9 years ago

Sorry for the late response.

I don't understand a thing about feeding (or popolution) with ALL strings of a particular column of autocomplete filters in multi_select. In your server side showcase you say _you have to add to your current JSON the following attributes yadcf_data_0 / yadcf_data1 / etc' //where each attribute contains a list of strings

a) Is possible feed using .JSON files only or is possible also with mysql database(sql files)? b) autocomplete in multi_select filter is working like in client version where strings appear and are filtered out as I type the words ?

Can you add in your server_side showcase also a multi_select + autocomplete filter with your prefiltered exFilterColumn function (_yadcf_data_0 / yadcf_data1..) please? In your example you have filter_type: "text", "auto_complete", "range_date" but not a multi_select+autocomplete filter. I wish to understand if multi_select + autocomplete really works and how it works in server-side.

It would be very helpful to have a live example

2) text mode data separator seems not working in server-side. I try a comma like separator but nothing change. If in my column I have Daniel,Vedmack comma separator is ignored and autocomplete don't returns me only Daniel word.

P.S: are you sure that exclude: truecheckbox works in server side mode? Seems not working. Can you add also exclude checkbox in your showcase?

Thanks in advance.

vedmack commented 9 years ago

Hi,

a) there is no need in any .json files, when using server side setup for datatables you are sending from you server a json string, so in order to populate yadcf filters (like multi select) you need to add yadcf_data_0 / yadcf_data_1.. for your filters and those yadcf_data_XXX should contain the values you want to display in that particular filters b) yes ?) will try to add soon (days) ?) any multi select (along with chosen/select2) behave like auto complete (see showcse select2/chosen pages) 2) when using server side the text separator and exclude must be treated on the server, the exclude will reflect in sending a different string to the server (beginning with ^((?!) and ending with ).)*$ so when that happens you know you need to do an exclude search on your server, as to the separator - there is no point to specify it on client since the search itself happens on server, so just consider that char on server when doing the search.

AlexPowen commented 9 years ago

thanks for clarification but something is still hard to understand. Can you include also a text separator example for multi_select filters in your server side showcase? It would be useful to see if it works as I think.

Can you include also a exclude filter (checkbox) example in your server side showcase, please?

Just a question about exclude filter for server: What must I send to server if I want to exclude only what I typing? in my example the word typed is daniel but after marked the checkbox I want display all words excluding daniel word.

Showcase example It would be the solution to all my questions. Thanks for patience but is also difficult for me understand if that's what I'm looking for.

vedmack commented 9 years ago

Hi, All your questions are really not related to yadcf, its more a sql querys related, and I recommend you to use stackoverflow for such questions, I can't tell when I'll have the time to update showcase with all of the above since I'm lacking spare time recently. So asking the right questions on stackoverflow would be much better in your case. Write a minimal question and explain what you getting right now and what you want to get...