thefear1989 / jquery-datatables-column-filter

Automatically exported from code.google.com/p/jquery-datatables-column-filter
0 stars 0 forks source link

Pre check checkbox filter #112

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,
This not an issue but an enhancement or a question if it is already possible.

Is there a way to pre check some of the checkboxes like we can do for select 
type ( type: "select", selected: 'Yes')

I have the 1.5 version.
Regards

ps (actually this question is for every filter : is possible to pre-filter a 
text type field or/and for date-range)

Original issue reported on code.google.com by gaspar...@gmail.com on 29 Jan 2013 at 4:11

GoogleCodeExporter commented 8 years ago
Ok, I have edit the code and I can now :
- pre check checkbox (tablo_checkboxes  is an array of value you want to check)
- pre add date for date-range(start_date_originale : is the start date, 
end_date_originale is the end date)

Example :
columnFilter({aoColumns:[
{ type: "checkbox", tablo_checkboxes:["Ouvert", "En cours"] },
{ type: "date-range", sRangeFormat :"Du {from} au {to}", 
start_date_originale:"01/02/2013", end_date_originale:"13/02/2013" }
]})

Hope this help

Original comment by gaspar...@gmail.com on 13 Feb 2013 at 2:13

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Iwas wondering what is the code I have to use to make the checkBox pre-checked 
using your customized file.
It seems that it is not shown in your code above.
thanks in advance for your help.
If it works it is a very nice improvment for this column filter plug-in.

Fred

Original comment by frederic...@gmail.com on 21 May 2013 at 9:51

GoogleCodeExporter commented 8 years ago
Hi,
Example :
columnFilter({aoColumns:[
{ type: "checkbox", tablo_checkboxes:["Value of Your pre check checkbox", 
"Value of a second pre checked checkbox"] },
{ type: "date-range", sRangeFormat :"Du {from} au {to}", 
start_date_originale:"01/02/2013", end_date_originale:"13/02/2013" }
]})

regards

Original comment by gaspar...@gmail.com on 21 May 2013 at 10:06

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Thanks for your quick response.
Sorry to bother you once again but I don't see how you make the distinction 
between values that are pre-checked and value that are not pre-checked.

For instance Let's say that I have three checkboxes : 
[] Monday, [] Tuesday, [] Wednesday 

and I only want to precheck Monday :
[x] Monday, [] Tuesday, [] Wednesday 

What would be the code ?

Thanks,

Fred

Original comment by frederic...@gmail.com on 21 May 2013 at 11:23

GoogleCodeExporter commented 8 years ago
columnFilter({aoColumns:[
{ type: "checkbox", tablo_checkboxes:["Monday"] }
]})
Hope this help

Original comment by gaspar...@gmail.com on 21 May 2013 at 11:27

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Actually I took a look at your code and to make you instance working I had to 
use this code regarding to my question :

columnFilter({aoColumns:[
{ type: "checkbox", values: ["Monday", "Tuesday", "Wednesday"], 
tablo_checkboxes:["Monday"] }
]})

But the most important conclusion is that you customized script works like a 
charm and solved the only remaining problem of columnfilter.

So thanks for sharing your knowledge.

Best.

Fred

Original comment by frederic...@gmail.com on 21 May 2013 at 12:09

GoogleCodeExporter commented 8 years ago
Nice to see that it helped you

Original comment by gaspar...@gmail.com on 21 May 2013 at 1:03

GoogleCodeExporter commented 8 years ago
Hi Gaspard.
Just to let you know that I did some changes in your file.
Of course it is up to you to consider these as inprovments or not :

1) I change line 516 to :
if (j == iLen - 1) checkbox.change();

2) I append this at the beginning of the checkbox.change on line 485 :
if (this != "[object HTMLDivElement]") return;

I made these changes in order to avoid to call the checkbox.change to many 
times for nothing.
I found it out when placing an alert("test"), in the function.

Hope it can help.

Fred

Original comment by frederic...@gmail.com on 22 May 2013 at 8:57

GoogleCodeExporter commented 8 years ago
Can you add your updated file because I get error if I use your code.

Original comment by gaspar...@gmail.com on 22 May 2013 at 9:44

GoogleCodeExporter commented 8 years ago
here is the updated file

Original comment by frederic...@gmail.com on 22 May 2013 at 11:42

Attachments:

GoogleCodeExporter commented 8 years ago
Many thanks Fred

Original comment by gaspar...@gmail.com on 22 May 2013 at 1:21

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Did you try to use more than one checkbox set in a table. I Mean I have a table 
with 3 columns (A, B and C) and column A is filtered with a given checkbox set, 
and Column C is also filtered with a checkbox set.
But the problem that I got is the checkbox set of column A is fine but the 
checkbox set of column C is not rendered correctly.

Did you try this user case ? If yes did you get this problem ?
Thanks.

Fred

Original comment by frederic...@gmail.com on 30 May 2013 at 1:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Hi Fred,
If I undersatnd you mean that you want 2 checkboxes being default checked (on 
page load).

See my image below it is exactly the case you mentionned and it is ok for me ?

Original comment by gaspar...@gmail.com on 30 May 2013 at 5:58

Attachments:

GoogleCodeExporter commented 8 years ago
PS did you notice : if the table is empty (because there is no data OR the 
default filtering hide all the data) columnfilter make datatable bug!

At this point I have not find any solution regarding this bug, do you ?

Original comment by gaspar...@gmail.com on 30 May 2013 at 6:00

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Concerning your comment #14. In your case you have only one column that is 
filtered using checkboxes (status).
It is not the case I was describing. In my case you have an additionnal column 
that is filtered using checkboxes (let's say the réponses column).
And in this case the second checkboxe panel is not well displayed.

Could you try to transform the filter of your réponses column from select to 
checkbox and tell me if both status and réponses checboxes are working ?

Thanks,

Fred

So 

Original comment by frederic...@gmail.com on 31 May 2013 at 7:21

GoogleCodeExporter commented 8 years ago
Hi Gaspard,

Concerning your comment #15 I did not noticed that.
I'll try to investigate.

Thanks,

Fred

Original comment by frederic...@gmail.com on 31 May 2013 at 7:23

GoogleCodeExporter commented 8 years ago
Hi Fred,
no I don't see any issue ?
What is your exact config ?

Original comment by gaspar...@gmail.com on 31 May 2013 at 8:21

Attachments: