That functionality is not included in Kendo UI, but you can use this jQuery plugin, for example, which allows you to highlight via
$("#searchGrid").highlight("mytext");
Pergunta
Is it possible to highlight all the occurences of a word the kendo grid?
The cell can contain multiple strings, if the word is in that string, I just want it highlighted?
My Grid looks like this
@(Html.Kendo().Grid(Model)
.Name("searchGrid")
.Columns(columns =>
{
columns.Bound(p => p.Title).Width(140);
columns.Bound(p => p.Name).Width(100);
columns.Bound(p => p.TheString).Width(200).Encoded(false);
})
.Pageable()
.Sortable()
.Groupable()
.Scrollable()
.Selectable()
.Filterable()
.HtmlAttributes(new {style = "height:430px;"})
.DataSource(dataSource => dataSource
.Server()
.PageSize(20)
.Model(model => model.Id(p => p.RowId))
).Resizable(resize => resize.Columns(true))
)
I am about to try something like this:
columns.Bound(p => p.TheString).Width(200).Encoded(false).Template(@<text>
@if (item.TheString.Contains(@ViewBag.SearchString))
{
<div style="background-color: Red;">
@item.TheString
</div>
} else
{
<div style="background-color: Green;">
@item.TheString
</div>
}
</text>)
I am using VS 2012 MVC 4 C#
Thanks.
Solução
That functionality is not included in Kendo UI, but you can use this jQuery plugin, for example, which allows you to highlight via
$("#searchGrid").highlight("mytext");