I have a grid with a checkbox template. When I check a checkbox, and click Edit, I get a popup window, which is expected, when I close the popup window, I destroy the grid and rebind the grid again.
When I go to select another record to edit and check that checkbox, then all of a sudden the checkbox of the very first row gets checked as well, and it doesnt matter which checkbox I check, because it also checks the first rows checkbox
The code I am using is
var
vendorGrid,
CreateVendorGrid =
function
(newData) {
$(
"#Vendor-Grid"
).kendoGrid({
dataSource: {
data: newData
},
schema: {
model: {
fields: {
VendorID: { type:
"number"
}
},
}
},
filterable: {
mode:
"row"
},
columns: [
{
template:
"<input name='Selected' class='checkbox' type='checkbox'>"
,
width:
"30px"
},
{
field:
"VendorName"
,
title:
"Vendor"
,
filterable: {
cell: {
showOperators:
false
,
operator:
"contains"
}
}
},
{
field:
"Email"
,
title:
"Email"
,
filterable: {
cell: {
showOperators:
false
,
operator:
"contains"
}
}
},
{
field:
"Phone"
,
title:
"Phone"
,
filterable:
false
},
{
field:
"City"
,
title:
"City"
,
filterable:
false
}],
scrollable:
true
,
sortable:
true
,
pageable: {
pageSize: 20
},
selectable:
"row"
,
height: $(
"#Vendor-Grid"
).closest(
".col-height-full"
).height()-60,
change:
function
(e) {
}
}).data(
"kendoGrid"
);
}
//This to get the data to populate the grid
function
GetVendorGridData() {
kendo.ui.progress($(
"#Vendor-Grid"
),
true
);
$.ajax({
type:
"GET"
,
url: URLParam.GetVendorsForGrid,
dataType:
"json"
,
contentType:
"application/json; charset=utf-8"
,
success:
function
(data, textStatus, jqXHR) {
CreateVendorGrid(data);
kendo.ui.progress($(
"#Vendor-Grid"
),
false
);
}
});
}
//This is part of my script in my popup window for closing the window
$(
"#btnCloseVendorEditor"
).click(
function
() {
RefreshVendorGrid();
GetVendorGridData();
CloseTheWindow();
});
function
RefreshVendorGrid() {
var
theGrid = $(
'#Vendor-Grid'
).data(
'kendoGrid'
);
theGrid.destroy();
}