jquery easyui datagrid使用脚本创建表头报错
把表头字段信息写在dom结构中就正常,使用js设置参数的形式就报错。错误信息:UncaughtTypeError:Cannotreadproperty'width'ofn...
把表头字段信息写在dom结构中就正常,使用js设置参数的形式就报错。错误信息:Uncaught TypeError: Cannot read property 'width' of null源码:<div id="dg" style="width: 1000px;"><!-- <thead><th field="id" width="80">id</th><th field="name" width="100">name</th><th field="age" width="80">age</th></thead> --></div><script type="text/javascript">var data = [];for(var i = 0 ; i < 10 ; i ++){data.push({id: "id_" + i,name: "name_" + i,age: i + 20});}$(function(){$("#dg").datagrid({data: data,columns: [{name: "id",field: "id"/*,width: 100*/},{name: "name",field: "name"/*,width: 100*/},{name: "age",field: "age"/*,width: 100*/}]});});</script>
展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询