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

How to style the last four row in my grid?I now can only style the last row

1 Answer 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Yin
Top achievements
Rank 1
Yin asked on 17 Aug 2013, 10:09 AM
my grid is like this:
.Name(MyGrid)
.Columns(columns =>
{
columns.Bound(p => p.ProductID);
columns.Bound(p => p.ProductName);
columns.Bound(p => p.UnitPrice);
columns.Bound(p => p.UnitsInStock);
})

I can style one row like :

dataBound: function () {
                    $("#MyGrid tbody tr:last").addClass("customClass");
                }

1 Answer, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 20 Aug 2013, 02:06 PM
Hi Yin,

You can get a part of a jQuery collection using .slice() method. If a negative number is provided, this indicates a position starting from the end of the set, rather than the beginning.

$("#MyGrid tbody tr").slice(-3).addClass("customClass");


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