0

我在 dojox.grid.DataGrid 中显示来自 htmlStore 表的数据。我希望在某些数据单元格中包含 html 内容(锚点 - a href)。我尝试对 htmlStore 表中的锚点进行硬编码,但显然这非常低效。

我被指示使用 htmlStore。我的偏好是使用 ItemFileWriteStore 然后我可以硬编码关联的 json 文件中的 url。

布局代码如下。提前致谢!


            dojo.require("dojox.data.HtmlStore");
            dojo.require("dojox.grid.DataGrid");
                // set the layout structure:
                var layoutDash = [

                [{
                    field: 'Order ID',
                    name: 'Order ID',
                    width: '56px'
                },
                {
                    field: 'Opportunity ID',
                    name: 'Opportunity ID',
                    width: '110px'
                },
                {
                    field: 'Opportunity Name',
                    name: 'Opportunity Name',
                    width: '170px'
                },
                {
                    field: 'Customer',
                    name: 'Customer',
                    width: '210px'
                },
                {
                    field: 'Sales Rep',
                    name:  'Sales Rep',
                    width: '80px'
                },
                {
                    field: 'Stage/Status',
                    name:   'Stage/Status',
                    width:  '100px'
                },
                {
                    field: 'Last Modified',
                    name:  'Last Modified',
                    width: '90px'
                },
                {   
                    field: 'Actions',
                    name:  'Actions',
                    width:  'auto',
                    editable: 'true'
                }]];
4

1 回答 1

0

解决。我创建了一个格式化程序“actionsURL”并将其添加到 grid.cell。


    {   
        field: 'Actions',
        name:  'Actions',
        width:  'auto',
        editable: 'true',
        formatter: actionsUrl
    }]];

然后在布局代码下面添加了函数。

重要的。如果您打算使用此技术,请阅读:应该有一个 html 锚将返回的值“编辑”封装在单引号中。它只是没有出现在我的演示代码中。

                  
        function actionsUrl() {
            return 'Edit';
        }
于 2011-05-17T22:20:05.660 回答