TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nigel Fernandes
NA
4.2k
1.5m
Kendo Grid filter with autocomplete textbox text and value
Feb 22 2018 8:11 PM
I'm trying to create a grid filter for my kendo grid, the column shows an ID value and I want the filter to search based on the text.
For example:
Column has employee ID and I want to search the grid with employee name but employee name is not a column. (
This is as per the requirement
)
I've managed to make the autocomplete work and load the employee names but how to I get the employee ID and filter the grid?
Sample Code:
@(Html.Kendo().Grid
<
abcModel
>
()
.Name("abc")
.DataSource(
dataSource
=
>
dataSource
.Ajax()
.Model(
model
=
>
model.Id(
i
=
>
i.id))
.Read(
read
=
>
read.Action("Load", "abccontroller"))
.PageSize(100)
)
.Filterable(
filter
=
>
filter.Enabled(true))
.Pageable(
pager
=
>
pager.Enabled(true))
.Resizable(
resize
=
>
resize.Columns(true))
.Columns(
columns
=
>
{
columns.Bound(
m
=
>
m.employeeID).Title("Employee Name").Filterable(
f
=
>
f.UI("empFilter").Extra(false));
})
)
<
script
type
=
"text/javascript"
>
function empFilter(element) {
element.kendoAutoComplete({
dataTextField: "Name",
dataValueField: "employeeID",
minLength: 3,
filter: "contains",
dataSource: {
serverFiltering: true,
serverSorting: true,
transport: {
read: "@Url.Action("Fetch", "abccontroller")",
type: "GET",
dataType: "json",
parameterMap: function (data, action) {
if (
action
=== "read") {
return {
text: data.filter.filters[0].value
};
}
}
}
}
});
}
</
script
>
Reply
Answers (
1
)
How to handle url parameter containing special characters?
I have a Three layer mvc project i want to do nunit testing