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

Month date picker filter and select after sort

2 Answers 699 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 2
Erik asked on 31 Mar 2017, 05:47 PM
I have two problems that I would like to see if there is a good answer to -- both can be seen in the following dojo:

http://dojo.telerik.com/@dahlsailrunner/uGOhO

 

1.  The Month Date Picker filter does not seem to work.  I'm pretty sure on this one I'm just doing something wrong and need some guidance.  I've got a date (always the first of the month) displaying in MMM-yy format in the grid, and would like a date picker filter for the months to work as expected.  Whenever I apply the date filter though, no results are shown.  Any help here is greatly appreciated.

2.  This next problem is more weird.  I've added functionality to go elsewhere when you double-click a row in the grid (it will just show an alert with the selected community on the dojo example).  This works fine, but if you sort the portfolio column a time or two the behavior gets strange -- and will not always show you the row that you double-clicked.  Can you help me figure out how to ensure that the double-clicked row is always the one that is marked as selected?  Have I done something wrong with the data source schema or the definition of the grid?

Thanks in advance for your help.

-Erik

2 Answers, 1 is accepted

Sort by
0
Accepted
Preslav
Telerik team
answered on 04 Apr 2017, 12:47 PM
Hi Erik,

As you have submitted a support ticket on the same topic and I already replied there, I am pasting the answer here in case anyone from the community encounters the same.

1) The reason for this behavior is the fact that the DatePicker default behavior is selecting the current day on opening. For example, Apr 4, 2017. When the user changes the month, the day will is not changed. Thus, there are no records after the filtering.

One of the possible solutions is manually setting the value of the DatePicker once the open event fires.

http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#methods-value
http://docs.telerik.com/kendo-ui/api/javascript/ui/datetimepicker#events-open

For example, with a code similar to:

open: function(e){
    if(!e.sender.value()){
        var date = new Date(2017,3,1);
        e.sender.value(date);
    }
}

2) The reason behind this faulty behavior is the memory leak that could be observed in the developer console. I would suggest removing the value from the data-bind property of the grid and reimplementing the continueImplementation function. For example,

data-bind="source: propertyList, value: selectedItem, events: {dataBound: gridBound }"

continueImplementation: function(e) {    
     var grid = $("#grid").data("kendoGrid");
     alert(grid.dataItem(grid.select()).communityName);
}


Finally, the modified Dojo is available here: http://dojo.telerik.com/evEmOw


Regards,
Preslav
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Erik
Top achievements
Rank 2
answered on 04 Apr 2017, 01:47 PM
Awesome response -- and your suggestions work perfectly.  Thanks!
Tags
Grid
Asked by
Erik
Top achievements
Rank 2
Answers by
Preslav
Telerik team
Erik
Top achievements
Rank 2
Share this question
or