| Page 1 of 1 | [ 7 posts ] |
Prasath M
|
Without pagination row formatting is working.
If I apply pagination to that datatable, pagination works but row formatting is not working. I need to apply pagination and custom row formatting. if possible please give some solution. My code is <style type="text/css"> /* Class for marked rows */ .yui-skin-sam .yui-dt tr.mark, .yui-skin-sam .yui-dt tr.mark td.yui-dt-asc, .yui-skin-sam .yui-dt tr.mark td.yui-dt-desc, .yui-skin-sam .yui-dt tr.mark td.yui-dt-asc, .yui-skin-sam .yui-dt tr.mark td.yui-dt-desc { background-color: #a33; color: #fff; } color: #fff; } </style> <!--end custom header content for this example--> </head> <body class="yui-skin-sam"> <!--BEGIN SOURCE CODE FOR EXAMPLE =============================== --> <div id="productTable" >productTable</div> <script type="text/javascript"> YAHOO.util.Event.onDOMReady(function () { YAHOO.example.Basic = function() { var myColumnDefs = [ {key:"lineNo", label:"lineNo" , formatter:YAHOO.widget.DataTable.formatNumber,sortable: true,editor: new YAHOO.widget.TextboxCellEditor({disableBtns: false})}, {key:"issueName", label:"issueName",editor: new YAHOO.widget.TextboxCellEditor({disableBtns:true})} ]; var myDataSource = new YAHOO.util.DataSource("welcome/init"); myDataSource.connMethodPost = true; myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSON; myDataSource.responseSchema = { resultsList: "marketBeanList", fields: [{key:"issueName"}, {key:"lineNo"} ] }; var myConfigs = { paginator: new YAHOO.widget.Paginator({ rowsPerPage: 490, template: YAHOO.widget.Paginator.TEMPLATE_ROWS_PER_PAGE, rowsPerPageOptions: [10,25,50,100,490,500], pageLinks: 15 }), sortedBy : {key:"lineNo", dir:YAHOO.widget.DataTable.CLASS_ASC}, draggableColumns:true }; var myRowFormatter = function(elTr, oRecord) { if (oRecord.getData('issueName') == 'GBP') { YAHOO.util.Dom.addClass(elTr, 'mark'); } return true; }; var myDataTable = new YAHOO.widget.DataTable("productTable", myColumnDefs, myDataSource,myConfigs,{formatRow: myRowFormatter}); myDataTable.subscribe("cellClickEvent", myDataTable.onEventShowCellEditor); return { oDS: myDataSource, oDT: myDataTable }; }(); }); </script> <!--END SOURCE CODE FOR EXAMPLE =============================== --> <!--MyBlogLog instrumentation--> <script type="text/javascript" src="http://track2.mybloglog.com/js/jsserv.php?mblID=2007020704011645"></script> </body> </html> Please give some solution. |
|
Cell formatting is independent of pagination. If you post your code on jsfiddle, I can take a look.
|
Prasath M
|
Thank you John Lindal.
But you cant invoke my datasource. Datasource is from controller side. How do I post in jsfiddle? |
|
Good point. jsfiddle doesn't handle server-side.
Looking at your code, I see that you are passing 5 arguments to the DataTable constructor, but the API docs specify that there are only 4 arguments. {formatRow: myRowFormatter} needs to be merged into myConfigs. |
Prasath M
|
How to merge row formatter in myconfigs?
please post the merged code.. Thank you for ur reply |
|
As simple as this:
var myConfigs = { paginator: new YAHOO.widget.Paginator({...}), sortedBy : {key:"lineNo", dir:YAHOO.widget.DataTable.CLASS_ASC}, draggableColumns:true, formatRow: myRowFormatter }; |
Prasath M
|
Thank you so much. I got it.
|
| Page 1 of 1 | [ 7 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