4 Answers, 1 is accepted
0
Hi Simon,
Regards,
Atanas Korchev
the Telerik team
This should be possible using the jQuery hide method:
var
grid = $(
"#grid"
).kendoGrid();
grid.tbody.find(
"tr:first"
).hide();
// hides the first row
Atanas Korchev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
ptw
Top achievements
Rank 1
answered on 20 Nov 2016, 11:37 AM
Just in case it helps someone else ...
1.
var
grid = $(
'#grid'
).data(
'kendoGrid'
);
2.
var
items = grid.dataSource.view();
3.
for
(
var
i = 0; i < items.length; i++) {
4.
if
(items[i].Type ==
"Sales"
) {
5.
var
$row = $(
'#grid'
).find(
"[data-uid='"
+items[i].uid+
"']"
);
// find grid row by uid
6.
$row.hide();
7.
}
8.
}
[Adapted from Alexander Popov's (ASP.NET) post: http://www.telerik.com/forums/how-to-hide-a-specific-row-in-kendo-ui-grid#ubk1WdVMoEOFgVwOyCykMw ]
0
ptw
Top achievements
Rank 1
answered on 20 Nov 2016, 12:07 PM
A refinement ... this gets nice the row/alt-row styling too ...
- Paul
01.
var
grid = $(
'#grid'
).data(
'kendoGrid'
);
02.
var
items = grid.dataSource.view();
03.
var
altRow =
false
;
// keep track of alt row for applying/removing k-alt class
04.
for
(
var
i = 0; i < items.length; i++) {
05.
var
$row = $(
'#grid'
).find(
"[data-uid='"
+items[i].uid+
"']"
);
// find grid row by uid
06.
if
(items[i].Type ==
"Sales"
) {
// hide this row ...
07.
$row.hide();
08.
}
else
{
// (This is a row that is not being hidden)
09.
if
(altRow) {
10.
$row.addClass(
"k-alt"
);
// add alt row class
11.
}
else
{
12.
$row.removeClass(
"k-alt"
);
// remove alt row class (just in case class exists)
13.
}
14.
altRow = !altRow;
// update altRow
15.
}
16.
}
0
Terrina
Top achievements
Rank 1
answered on 26 Apr 2017, 09:06 PM
Thank you, this helped me out with a problem I was having!