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?
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
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.