Reputation: 1789
I've got a YUI DataTable with various columns that represents a list of users. I would like to add a column that contains a button in each row with a specific label (say, "grant access") and which invokes some function when clicked. Is this possible?
I've tried checking the YUI documentation, but as far as I can see, they don't allow you to change the label of the button itself in the way I allude to here. Any hints?
Upvotes: 3
Views: 3102
Reputation: 2581
In your column definitions, You should be able to specify a formatter ala
var myCols = [
... /* your other cols */
{
key: 'foo', formatter: function (cell, rec, col, data) {
cell.innerHTML = '<button type="button">'+data+'</button>';
}
}
];
Custom formatters give you complete control over what is rendered into the cell. Also look at this example
Upvotes: 6