Reputation: 101
Given http://jsfiddle.net/MG89G/271/ my issue is filtering the Kendo UI grid after the checkboxes changed in dropdownlist with multi selection. I want to filter the grid with orderID.
I got the solution with single selection http://jsfiddle.net/schapman/HyHZG/5/.
But how do I do it with multi selection dropdownlist?
Upvotes: 2
Views: 8846
Reputation: 1646
new version of kendo ui support this properties
http://demos.telerik.com/kendo-ui/grid/filter-multi-checkboxes
Upvotes: 0
Reputation: 20193
You can integrate the same approach within the Grid with a small tweak to remove the data-bind attribute.
Upvotes: 1
Reputation: 2204
I create this one:
var dropdown = $(selector).kendoDropDownList({
template: $("#general-templates .multiselect-item").html(),
select: function(e)
{
var dropdownlist = this;
var dataItem = this.dataItem(e.item.index());
if(dataItem.value==="")
{
e.item.closest("ul").find("span").each(function(){
$(this).css("display","none");
});
dropdownlist.text(dataItem.text);
dropdownlist.element.closest(".field-group").find("input[type='hidden']").val("");
return;
}
if(e.item.find("span").css("display")==="none")
e.item.find("span").css("display","");
else
e.item.find("span").css("display","none");
var values = [];
var labels = [];
e.item.closest("ul").find("span").each(function(){
if($(this).css("display")==="none")
return;
values.push($(this).attr("data-value"));
labels.push($(this).parent().text());
});
if(values.length===0)
labels.push(e.item.closest("ul").find(".dropdownlist-item:first").text());
dropdownlist.element.closest(".field-group").find("input[type='hidden']").val(values.join(","));
setTimeout(function(){
dropdownlist.value("999");
dropdownlist.text(labels.join(","));
},50);
}
}).data("kendoDropDownList");
var select = dropdown.wrapper.find("select");
dropdown.wrapper.append("<input type='hidden' class='filter' value='' data-field='{0}' data-operator='{1}'>".format(select.attr("data-field"),select.attr("data-operator")));
Upvotes: 0
Reputation: 3055
The kendo team has added a new MultiSelect box. Here is a sample of filtering a grid using one.
http://jsbin.com/ameyam/1/edit
Upvotes: 0