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

Setting month view to display 5 weeks instead of 6 (when appropriate)

1 Answer 242 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
Kjell
Top achievements
Rank 1
Kjell asked on 29 Oct 2013, 08:23 PM
I was asked to hide the first or last row in the month view when all the entries on that row are actually for the next or previous month.  For example for the month of October 2013, the bottom row contains all days in November.

There is no out of the box way to do this but it's actually pretty easy.  I'd like to share my solution and get feedback, please let me know is there is a better way to do it.
//define the cells and rows
var gridCells = $("td[role='gridcell']");                            
var gridRows = $("tr[role='row']"); 
 
//figure out if we should hide the first and/or last row                       
//class will be null if it's normal, otherwise 'k-other-month'                       
if (gridCells[6].getAttribute("class") != null) { $(gridRows[0]).css("display", "none"); }                       
if (gridCells[35].getAttribute("class") != null) { $(gridRows[5]).css("display", "none"); }
I call the above code in my 'dataBound' event handler because I refresh the datasource during navigation.  The 'navigate' handler is probably more appropriate in most cases.

My only concern is that there are other possible classes for the gridcells which I am not yet aware of, which would cause the row to be unintentionally hidden.  Maybe it would be better to check if the class is not 'k-other-month' instead of just looking to see if it is not null?



1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 31 Oct 2013, 03:29 PM
Hi,

 
Basically removing rows from the month view is not supported out-of-the-box and you should implement custom solution to achieve the desired behavior. Possible solutions are to implement custom view or use for example the navigate event to find the last row in the current view and hide it using jQuery.

Regards,
Vladimir Iliev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Scheduler
Asked by
Kjell
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or