Hi all,
I have a listView with the following bindings:
listView.bind(
"remove"
,
function
(e) {
$.ajax({
type :
"POST"
,
url : vulnerabilityAssessment.deleteVulnerabilityAssessmentItem.replace(
"{itemId}"
, e.model.id),
contentType :
'application/json'
,
dataType :
"json"
,
success :
function
(response) {
refreshCurrentListView(listViewId, scope);
},
});
}
listView.bind(
"save"
,
function
(e) {
var
item = {
id: ...,
vulnerabilityAssessment: vulnerabilityAssessmentId,
.....
}
if
(e.model.id ==
null
)
item.id = -1;
$.ajax({
type :
"POST"
,
url : vulnerabilityAssessment.saveVulnerabilityAssessmentItem,
contentType :
'application/json'
,
data : JSON.stringify(item),
complete :
function
(e) {
refreshCurrentListView(listViewId, scope);
},
error :
function
(e) {
showErrorDialog(e);
},
dataType :
"json"
});
});
And the refreshCurrentListView function as follows:
function
refreshCurrentListView(listViewId, scope) {
var
type = parseInt(listViewId.substr(listViewId.indexOf(
"_"
) + 1));
var
vulnerabilityAssessmentId = $(
"#vulnerabilityCurrentAssessmentListView"
, scope).children(
'div'
).children(
'div'
)[0].id.substr($(
"#vulnerabilityCurrentAssessmentListView"
, scope).children(
'div'
).children(
'div'
)[0].id.indexOf(
"_"
) + 1);
if
(listViewId.includes(
"Strenght"
)) {
var
itemViewModel = itemViewStrength(vulnerabilityAssessmentId, type,
'S'
);
kendo.bind ($(
"#threatCurrentVulnerabilityAssessment #"
+ listViewId, scope), itemViewModel);
$(
"#threatStrenghtListView_"
+ type +
" .edit-buttons"
).show();
}
}
I'm adding a new record on the list and as soon as I add a second row , I get the following exception:
Uncaught TypeError: Cannot read property
'data'
of undefined
at init.setup (kendo.all.min.js:27)
at init.create (kendo.all.min.js:27)
at Object.<anonymous> (kendo.all.min.js:27)
at Function.Deferred (jquery.min.js:2)
at init._promise (kendo.all.min.js:27)
at init._send (kendo.all.min.js:27)
at init.sync (kendo.all.min.js:27)
at init.save (kendo.all.min.js:54)
at HTMLAnchorElement.<anonymous> (kendo.all.min.js:54)
at HTMLDivElement.dispatch (jquery.min.js:3)
This exception happens when the ajax call inside the 'save' binding takes place (and before it gets to the complete function).
Any ideas?