views:

596

answers:

1

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?

+4  A: 

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

Luke