| Page 1 of 1 | [ 4 posts ] |
|
Can any one give me an simple example of displaying anchar tags in column headers in datatable
say we have a table Student Name RollNo Age ram 1 20 sham 2 25 only Name,RollNo,Age should have anchor tags in blue color(i.e First Row thead).If i click on name it show go to http://www.yahoo.com. If i click on age it should go to http://www.yuilibrary.com. Is this possible. |
|
sample code here title column header is not clickable see the below code
YAHOO.util.Event.addListener(window, "load", function() { YAHOO.example.Basic = function() { var myColumnDefs = [ {key:"id", sortable:true, resizeable:true}, {key:"date", formatter:YAHOO.widget.DataTable.formatDate, sortable:true, sortOptions:{defaultDir:YAHOO.widget.DataTable.CLASS_DESC},resizeable:true}, {key:"quantity", formatter:YAHOO.widget.DataTable.formatNumber, sortable:true, resizeable:true}, {key:"amount", formatter:YAHOO.widget.DataTable.formatCurrency, sortable:true, resizeable:true}, {key:"title",formatter:"myCustom", resizeable:true} ]; var myDataSource = new YAHOO.util.DataSource(YAHOO.example.Data.bookorders); myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; myDataSource.responseSchema = { fields: ["id","date","quantity","amount","title"] }; YAHOO.widget.DataTable.Formatter.myCustom = function(el, oRecord, oColumn, oData) { if(YAHOO.lang.isString(oData)) { el.innerHTML = "<a href=\"" + oData + "\">" + oData + "</a>"; } else { el.innerHTML = YAHOO.lang.isValue(oData) ? OData : ""; } }; |
|
You can use the label property in the column definition. The value for that property is usually a simple string, and it defaults to the value of the key if undefined, however, it can also be plain HTML code such as an anchor. Cell formatters are for formating the data cells under the header, not the header itself.
|
|
Thanks satyam.Is it possible to use resize feature of data table without affecting existing functionaly of my existing table.I dont want any css of datatable i want only resize feature of datatable
|
| Page 1 of 1 | [ 4 posts ] |
| You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum |
© 2006-2013 Yahoo! Inc. All rights reserved.
All code on this site is licensed under the BSD License unless stated otherwise.
About This Site · Security Contact Info
Powered by phpBB® Forum Software © phpBB Group