简体   繁体   中英

Column of links in Ember Table

Lets say that I have a model with two attributes: name and url . If I want to build a column of links like this <a href="url">name</a> how can I do it? as far as I know, using contentPath or getCellContent only allow me to send one of those attributes.

I've been trying something like this:

controller.js

Column.create({
  headerCellName: 'link',
  contentPath: 'url',
  tableCellView: TableCell.extend({
    templateName: 'link'
  })
})

link.hbs

{{#link-to view.cellContent}} 
 ???
{{/link-to}}

But I'm stuck in the way of letting the template know those two fields. I'm very new to ember so sorry if this is a newbie question. Thanks in advance.

I've found the solution. It seems that in the end, getCellContent allows to pass the complete model so I can access its attributes by view.row.name or view.row.url in the template.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM