简体   繁体   English

错误:“无法读取未定义的属性 'nodename'” 转换 html 表时

[英]Error : “cannot read property 'nodename' of undefined” While converting html Table

I am trying to convert an HTML Table to KendoGrid but getting an error while executing this我正在尝试将 HTML 表转换为 KendoGrid,但在执行此操作时出错

 $("#ReportExport").kendoGrid({ toolbar: ["excel"], filterable: { mode: "row" }, pageSize: 25, sortable: true, columnMenuInit(e) { e.container.find('li[role="menuitemcheckbox"]:nth-child(1)').remove(); e.container.find('li[role="menuitemcheckbox"]:nth-child(4)').remove(); }, columnMenu: { filterable: false }, reorderable: true, resizable: true, pageable: { alwaysVisible: true, pageSizes: [25, 100] }, });

and the console says this Uncaught TypeError: Cannot read property 'nodeName' of undefined at N (kendo.all.js:7692)控制台说这个 Uncaught TypeError: Cannot read property 'nodeName' of undefined at N (kendo.all.js:7692)

This error can be due to the element not being available when the script tries to access it.此错误可能是由于脚本尝试访问该元素时该元素不可用。

You can try to insert your code on a document.ready function to make sure your DOM is loaded or check if the element is available before running your code.您可以尝试在 document.ready function 上插入代码,以确保您的 DOM 已加载或在运行代码之前检查该元素是否可用。

I got this one.我得到了这个。 Actually I was unaware of the difference between $("#GridName").KendoGrid() and $("#GridName").data('kendoGrid') .实际上我不知道$("#GridName").KendoGrid()$("#GridName").data('kendoGrid') First one basically initialize the grid.Later on,if you want to operate the grid,You have to get it first in a variable by using second method.第一个基本上是初始化网格。后面如果要操作网格,你必须先用第二种方法在一个变量中获取它。 So the problem lies here所以问题出在这里

 columnMenuInit(e) { e.container.find('li[role="menuitemcheckbox"]:nth-child(1)').remove(); e.container.find('li[role="menuitemcheckbox"]:nth-child(4)').remove(); }

Since the method I was using is for initialization,so grid was unable to perform the required functionality.由于我使用的方法是用于初始化,因此网格无法执行所需的功能。 Thanks to Diogo Peres for giving me right direction.感谢 Diogo Peres 给了我正确的方向。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 TypeError:无法读取未定义的属性“ nodeName” - TypeError: Cannot read property 'nodeName' of undefined 无法读取SVG文件中未定义的属性“ nodeName” - Cannot read property 'nodeName' of undefined in SVG file 无法使用select2读取jQuery验证上未定义的nodeName属性 - Cannot read property of nodeName undefined on jQuery validation with select2 bs-tooltip TypeError:无法读取未定义的属性“nodeName” - bs-tooltip TypeError: Cannot read property 'nodeName' of undefined VideoJS 错误 Uncaught TypeError: Cannot read property 'nodeName' of null - VideoJS error Uncaught TypeError: Cannot read property 'nodeName' of null 从 PHP 转换后无法读取未定义 Javascript 错误的属性“0” - Cannot read property '0' of undefined Javascript error after converting from PHP 未捕获的类型错误:无法读取 null 的属性“nodeName” - Uncaught TypeError: Cannot read property 'nodeName' of null 在与HTML一起使用时,无法读取用玉石和主干线定义的未定义属性“地图” - Cannot read property 'maps' of undefined with jade and backbone while it works with HTML 从JSON数据创建HTML表时出现“无法读取未定义的属性'用户名'”错误 - “Cannot read property 'username' of undefined” error when creating html table from JSON data Chrome表示无法使用Google Map API读取未定义的属性“ nodeName”,IE6很好 - Chrome says Cannot read property 'nodeName' of undefined, IE6 is fine, using Google Map API
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM