I'm getting an javascript error when trying to filter the scheduler using a Guid from a dropdownlist. I had a very similar error when filtering by an int. That was fixed by using parseInt(this.value) instead of using this.value and then assigning the parseInt to the filter value like:
Now I'm having the same type of error when the DataValueField of the dropdownlist is a Guid.
I'm doing this:
I placed a break point in the code and 'selection' is a valid guid string and it is the guid that I expected it to be.
Can you filter by a Guid?
var
filter = {
logic:
"or"
,
filters: [
{
operator:
"eq"
,
field:
"AssetID"
,
value: parseInt(
this
.value())
}
]
};
I'm doing this:
<
div
style
=
"margin-left: 30px; margin-bottom: 20px"
>
Choose Owner:
@(Html.Kendo().DropDownList()
.Name("Owner")
.DataTextField("DisplayName")
.DataValueField("UserID")
.DataSource(ds => ds.Read("TaskUsers", "Users"))
.Events(events => events.Change("userChange"))
)
</
div
>
function
userChange() {
var
scheduler = $(
"#scheduler"
).data(
"kendoScheduler"
);
var
selection =
this
.value();
if
(selection ==
"00000000-0000-0000-0000-000000000000"
) {
scheduler.dataSource.filter([]);
}
else
{
var
filter = {
logic:
"or"
,
filters: [
{
operator:
"eq"
,
field:
"AssetID"
,
value: selection
}
]
};
scheduler.dataSource.filter(filter);
}
}
I placed a break point in the code and 'selection' is a valid guid string and it is the guid that I expected it to be.
Can you filter by a Guid?