How can we search only year in date field ?

QuestionsHow can we search only year in date field ?
Hemant Mahale asked 6 years ago

Hello Abu,
Here, in a date field, we have column filter with calendar search design which is working fine.
With above calendar search we need only year search too, is it possible?

i.e
After typing 2015 in date column filter we can fetch all 2015 dates

1 Answers
Abu Ghufran Staff answered 6 years ago

Option1: Use dbname property to change where clause field name. e.g. if field is: invdate

$col[“dbname”] = “date_format(invdate,’%Y’)”;

Drawback is you can’t use exact date/month search in it. Only year search.

Option2: Use contains search on date field. Pasting from docs:

By default, datepicker does not perform ‘contains’ search. If you wish to enable, you need to set following with date column. This will disable datepicker.

// contains search
$col[“searchoptions”][“sopt”] = array(“cn”);

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Your Answer

3 + 0 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?