我正在尝试向Dojo Datagrid添加删除按钮,我目前有以下
javascript:
原文链接:https://www.f2er.com/dojo/290874.htmlfunction createGrid() { gridTmp = new dojox.grid.DataGrid({ store: jsonStore,structure: [ {name: "Report No",field:"inc_number"},{name: "Incident Date",field: "IncidentDate"},{name: "Report Date",field: "reportDate"},{name: "Location",field: "location"},{name: "Delete",field: "inc_number",formatter: getDelete} ],noDataMessage: 'No results returned' },"grids"); return gridTmp; } dojo.addOnLoad(function() { grid = createGrid(); grid.startup(); }); function getDelete(item) { return "<button onclick=\"location.href='/report?command=delete&reportNo=" + store.getIdentity(item) + "'\">Delete</button>"; }
每当我加载页面时,我只会得到一个空格,上面写着“抱歉发生错误”.如果我用“getDelete”格式化程序删除最后一个字段,那么datagrid就可以正常填充.我不确定我做错了什么,所以任何帮助都将不胜感激.