when jquery is 1.X,we can do like this
<script>
$(document).ready(function () {
$("#grid").kendoGrid({
dataSource: dataSource,
columns: [{
field: "ContactName",
title: "Contact Name",
values: getDictName('type')
}, {
field: "ContactTitle",
title: "Contact Title"
}]
});
function getDictName(type){
$.ajax({
url:"demo.action",
success:function(result){
return result;//the result like:[{key:'a',value:'apple'},{key:'o',value:'orange'}]
}});
}
});
</script>
but when we change jquery to 3.X, the function of 'getDictName' is not work,because jquery-3.x is not support for 'async:false', so before the function-getDictName returned the result, the kendoGrid is already performed.
Hello,
Indeed, as of jQuery 1.8, the async: false is deprecated. You will have to workaround it, for example:
$(document).ready(function () { var values = getDictName(); function getDictName(type){ $.ajax({ url:"demo.action", success:function(result){ return result; } }).done(function() { $("#grid").kendoGrid({ dataSource: dataSource, columns: [{ field: "ContactName", title: "Contact Name", values: values }, { field: "ContactTitle", title: "Contact Title" }] }); }); } });
Regards,
Nikolay