Hello Guys,
I have the following dropdownlist with a custom template:
Html.Kendo()
.DropDownList()
.HtmlAttributes(new { style = "width:100%; " })
.BindTo(Model.FilterShops)
.DataTextField("DisplayValue")
.DataValueField("Id")
.Template("<input type='checkbox' id='#=data.Id #' name='superPlayer#=data.Id #' value='#=data.IsSelected #' />" + " " + "${ data.DisplayValue}")
.Name("cb_SuperPlayer")
.Events(ev => ev.Close("cb_SuperPlayer_closed"))
.Filter(FilterType.Contains)
If i open the dropdownlist and check some of the checkboxes, on the close event i will correctly get the ones checked into an array.
The problem is when i use the search textbox of the control to filter the items, if i check some of them, after the dropdownlist closes the selections are all cleared..
So for example lets say that my collection has: [Whatever, Test1, Test2, SomeOtherText]. If i just open the dropdownlist and select whatever and test1 and then close it, after i collapse it again, my checkboxes are still checked.
If i open the dropdownlist and search for "test", and check test1, test2, close the dropdownlist and then collapse it again, the two selections are cleared.
Hope you can help me figure this out.
P.S: This is the method for onclosed to get the checked selections
function cb_SuperPlayer_closed() {
var selShops = new Array();
var doc = document.getElementById("cb_SuperPlayer_listbox");
var chkBoxes = doc.getElementsByTagName("input");
for (var i = 0; i < chkBoxes.length; i++) {
if (chkBoxes[i].checked)
selShops.push(chkBoxes[i].id);
}
}
Regards,
Fran
I have the following dropdownlist with a custom template:
Html.Kendo()
.DropDownList()
.HtmlAttributes(new { style = "width:100%; " })
.BindTo(Model.FilterShops)
.DataTextField("DisplayValue")
.DataValueField("Id")
.Template("<input type='checkbox' id='#=data.Id #' name='superPlayer#=data.Id #' value='#=data.IsSelected #' />" + " " + "${ data.DisplayValue}")
.Name("cb_SuperPlayer")
.Events(ev => ev.Close("cb_SuperPlayer_closed"))
.Filter(FilterType.Contains)
If i open the dropdownlist and check some of the checkboxes, on the close event i will correctly get the ones checked into an array.
The problem is when i use the search textbox of the control to filter the items, if i check some of them, after the dropdownlist closes the selections are all cleared..
So for example lets say that my collection has: [Whatever, Test1, Test2, SomeOtherText]. If i just open the dropdownlist and select whatever and test1 and then close it, after i collapse it again, my checkboxes are still checked.
If i open the dropdownlist and search for "test", and check test1, test2, close the dropdownlist and then collapse it again, the two selections are cleared.
Hope you can help me figure this out.
P.S: This is the method for onclosed to get the checked selections
function cb_SuperPlayer_closed() {
var selShops = new Array();
var doc = document.getElementById("cb_SuperPlayer_listbox");
var chkBoxes = doc.getElementsByTagName("input");
for (var i = 0; i < chkBoxes.length; i++) {
if (chkBoxes[i].checked)
selShops.push(chkBoxes[i].id);
}
}
Regards,
Fran