This is a migrated thread and some comments may be shown as answers.

How to set the default date on filter for Date field

1 Answer 9 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
nhaydon
Top achievements
Rank 1
nhaydon asked on 13 Sep 2012, 02:58 PM
I am trying to set the default date to today when the user clicks the filter icon on the column. Ideally have it selected in the calendar drop down. Any help would be appreciated.

1 Answer, 1 is accepted

Sort by
0
nhaydon
Top achievements
Rank 1
answered on 14 Sep 2012, 03:14 PM
looks like I got it. took some of this from a code library:

$("#Grid th:contains(Begin Date)") //find the header cell (th) for our column (Category)
       .find(".t-grid-filter") //find the filter button
       .click(function (e) { // subscribe to its click event
           var filterIcon = $(this);
 
           setTimeout(function () { //delay execution to allow the filtering menu to be created
               //get filter
               var filterMenu = filterIcon.data("filter");
               //get the filter datepicker
               var test = filterMenu.find('#GridCPBDTfirst').data('tDatePicker');
               //set default date to today
               test.value(new Date());
 
           });
       });
Tags
Grid
Asked by
nhaydon
Top achievements
Rank 1
Answers by
nhaydon
Top achievements
Rank 1
Share this question
or