Загрузка JS-скрипта после загрузки сетки Kendo ⇐ C#
-
Гость
Загрузка JS-скрипта после загрузки сетки Kendo
this is a part of my cshtml code in NopCommerce:
new ColumnProperty(nameof(BusinessUnitCustomerModel.Approved)) { Title = T("Admin.BusinessUnit.Customers.Fields.Approved").Text, ClassName = NopColumnClassDefaults.CenterAll, Render = new RenderSwitchButton("", T("Admin.BusinessUnit.Customers.Fields.ToggleApprove").Text) { OnClickFunctionName = "toggleApprovedCustomer", OnLoadFunction = "toggleApprovedCustomerLoad" },Data=nameof(BusinessUnitCustomerModel.CustomerBusinessUnitId) }, I write a JS script wanna be loaded after the page loading is finished. This is my script code below:
$(document).ready(function () { window.alert($('.switchbuttongrid').length()) }) function toggleApprovedCustomerLoad(elem, data) { var postData = { id: data }; addAntiForgeryToken(postData); $.ajax({ cache: false, type: "POST", url: "@(Url.Action("ToggleApprove", "BusinessUnit"))", data: postData, success: function (data, textStatus, jqXHR) { updateTable('#businessunitCustomers-grid'); }, error: function (jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); } Can somebody help me to solve this problem? (I need this script load after the page loading is done)
Источник: https://stackoverflow.com/questions/781 ... -be-loaded
this is a part of my cshtml code in NopCommerce:
new ColumnProperty(nameof(BusinessUnitCustomerModel.Approved)) { Title = T("Admin.BusinessUnit.Customers.Fields.Approved").Text, ClassName = NopColumnClassDefaults.CenterAll, Render = new RenderSwitchButton("", T("Admin.BusinessUnit.Customers.Fields.ToggleApprove").Text) { OnClickFunctionName = "toggleApprovedCustomer", OnLoadFunction = "toggleApprovedCustomerLoad" },Data=nameof(BusinessUnitCustomerModel.CustomerBusinessUnitId) }, I write a JS script wanna be loaded after the page loading is finished. This is my script code below:
$(document).ready(function () { window.alert($('.switchbuttongrid').length()) }) function toggleApprovedCustomerLoad(elem, data) { var postData = { id: data }; addAntiForgeryToken(postData); $.ajax({ cache: false, type: "POST", url: "@(Url.Action("ToggleApprove", "BusinessUnit"))", data: postData, success: function (data, textStatus, jqXHR) { updateTable('#businessunitCustomers-grid'); }, error: function (jqXHR, textStatus, errorThrown) { alert(errorThrown); } }); } Can somebody help me to solve this problem? (I need this script load after the page loading is done)
Источник: https://stackoverflow.com/questions/781 ... -be-loaded
Мобильная версия