带有空数据的Dojox.grid.DataGrid(Dojox.grid.DataGrid with empty Data)

编程入门 行业动态 更新时间:2024-10-15 20:23:08
带有空数据的Dojox.grid.DataGrid(Dojox.grid.DataGrid with empty Data)

我的问题是数据网格没有出现我需要它是空的所以我可以添加项目来与现有的FilteringSelect Formatter建立关系。

function formatter1() { var x = new FilteringSelect({ name: "Account Select", //value: "1", store: remoteData, searchAttr: "name", onChange: function () { console.log("EI"); } }); x._destroyOnRemove=true; return x; }

//关系数据网格

var DataRelations = { identifier: "id", items: [] }; storeRelations = new Write({data: DataRelations, clearOnClose: true }); var layoutRelations = [ {'name': "Words", field: "word", width: 40 }, {'name': "Account", field: "id", width: 40, formatter: formatter1 } //,{'name': "Accounts Available", field: "AccountsAvailable", width: 20, formatter: formatter1} ]; var gridRelations = new DataGrid({ id: 'gridRelations', store: storeRelations, structure: layoutRelations, rowSelector: '10px' }); /*append the new grid to the div*/ gridRelations.placeAt("gridDivRelations"); /*Call startup() to render the grid*/ gridRelations.startup();

My problem is that the datagrid does not appear I need it to be empty so I can add items to do a relation with a existing FilteringSelect Formatter.

function formatter1() { var x = new FilteringSelect({ name: "Account Select", //value: "1", store: remoteData, searchAttr: "name", onChange: function () { console.log("EI"); } }); x._destroyOnRemove=true; return x; }

// Relations data grid

var DataRelations = { identifier: "id", items: [] }; storeRelations = new Write({data: DataRelations, clearOnClose: true }); var layoutRelations = [ {'name': "Words", field: "word", width: 40 }, {'name': "Account", field: "id", width: 40, formatter: formatter1 } //,{'name': "Accounts Available", field: "AccountsAvailable", width: 20, formatter: formatter1} ]; var gridRelations = new DataGrid({ id: 'gridRelations', store: storeRelations, structure: layoutRelations, rowSelector: '10px' }); /*append the new grid to the div*/ gridRelations.placeAt("gridDivRelations"); /*Call startup() to render the grid*/ gridRelations.startup();

最满意答案

这是一个基于你的代码的工作jsfiddle:

http://jsfiddle.net/LFk8Z/

您需要为网格的DIV容器指定宽度和高度。 也许这是最初的问题。 您还需要加载网格css资源。 您的格式化程序函数没有参数,但您需要指定一个参数:

function formatter1(x) { // Format cell value (which is in x) in here. }

here is a working jsfiddle based on your code:

http://jsfiddle.net/LFk8Z/

You need to specify a width and a height for the DIV container of the grid. Maybe that was the initial problem. Also you need to load the grid css resources. Your formatter function did not have a paramater, but you need to specify one:

function formatter1(x) { // Format cell value (which is in x) in here. }

更多推荐

本文发布于:2023-07-30 18:23:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1338891.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据   Dojox   grid   Data   empty

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!