jendresden
jendresden

Reputation: 31

YUI DataTable : How to edit the column headers?

I would like to be able to edit the column headers in the same manner that I can alter row-values. Anyone come up with a way to do this? I don't see any mention of it in the docs.

Upvotes: 3

Views: 3205

Answers (2)

Justin Tanner
Justin Tanner

Reputation: 14372

I wanted to place a checkbox in the header instead of a regular title. The label attribute will take HTML.

Here is an example of the myColumnDefs I pass into the YUI Datatable:

var myColumnDefs = [
    {key:"check", label:'<input id="check-all" type="checkbox" onclick="checkAll()">', formatter:"checkbox"},
    {other columns}
];            

Upvotes: 3

Tom
Tom

Reputation: 962

The column header are set up in the columnDefs:

 var myColumnDefs = [
      {key:"myID", label:"id", sortable:true},
      {key:"myDate", label:"date", sortable:true},
      {key:"MyStatus", label:"status", sortable:false}
                    ];

if you want to be able to change it dynamically, you will have to remove the label's value, and apply css to the first row, so it looks like it is a header. and then use inline Cell Editing as usual in YUI. Just an idea! 'Cause so far I don't think YUI is providing method to just do that!

Upvotes: 0

Related Questions