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.
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?
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"
); }
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?