最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - dojo dgrid custom render cell contents - Stack Overflow

programmeradmin2浏览0评论

I'm using a dgrid but find the documentation available from the website (/) a bit lacking: it teaches you the basics but seems to leave you to work out how to do anything more plex by guesswork.

Specifically, I want to modify how the data I've loaded into a memory store is rendered. For example, I'd actually like to bine two columns from the store into one column in the grid with some additional text. Obviously one way would be to create a second memory store, iterate the first store and build the exact contents the dgrid should show in the second store. However, that feels clunky and like having to have two sets of the same data, just differently formated.

I can see there are renderRow and renderCell methods. Can anyone give me examples of how to use these, or point me to some documentation?

Thanks, Simon

I'm using a dgrid but find the documentation available from the website (http://dojofoundation/packages/dgrid/) a bit lacking: it teaches you the basics but seems to leave you to work out how to do anything more plex by guesswork.

Specifically, I want to modify how the data I've loaded into a memory store is rendered. For example, I'd actually like to bine two columns from the store into one column in the grid with some additional text. Obviously one way would be to create a second memory store, iterate the first store and build the exact contents the dgrid should show in the second store. However, that feels clunky and like having to have two sets of the same data, just differently formated.

I can see there are renderRow and renderCell methods. Can anyone give me examples of how to use these, or point me to some documentation?

Thanks, Simon

Share Improve this question asked Aug 31, 2013 at 14:07 KateKate 1,5761 gold badge17 silver badges36 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

The renderCell function gives you the data object, so you can build the cell using any properties from the data.

var columns = [
  {
    label : ' ',
    field : 'plexCell',
    renderCell: function(object, value, node, options) {
      domHtml.set(node, object[propA] + ' (' + object[propB] + ')');
    }
  },
  ...
];
发布评论

评论列表(0)

  1. 暂无评论