EasyUI Forum
September 14, 2025, 01:09:58 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: setting style attributes for the footer  (Read 11187 times)
pb
Newbie
*
Posts: 1


View Profile
« on: May 11, 2013, 03:59:57 AM »

I have been working with the demo for the datagrid footer.  I see how to set specific cells as a highlight color and font color.  How do you set the footer style?  Such as font color, background, bold, etc..?

This is a great UI tool and the examples are really appreciated.
Logged
stworthy
Administrator
Hero Member
*****
Posts: 3581


View Profile Email
« Reply #1 on: May 11, 2013, 08:36:38 AM »

By default the 'rowStyler' option is invalid for footer rows. To enable it, the datagrid's view should be overridden. Here is the code to make footer rows have 'rowStyler' feature.
Code:
var myview = $.extend({}, $.fn.datagrid.defaults.view, {
renderFooter: function(target, container, frozen){
var opts = $.data(target, 'datagrid').options;
var rows = $.data(target, 'datagrid').footer || [];
var fields = $(target).datagrid('getColumnFields', frozen);
var table = ['<table class="datagrid-ftable" cellspacing="0" cellpadding="0" border="0"><tbody>'];

for(var i=0; i<rows.length; i++){
var styleValue = opts.rowStyler ? opts.rowStyler.call(target, i, rows[i]) : '';
var style = styleValue ? 'style="' + styleValue + '"' : '';
table.push('<tr class="datagrid-row" datagrid-row-index="' + i + '"' + style + '>');
table.push(this.renderRow.call(this, target, fields, frozen, i, rows[i]));
table.push('</tr>');
}

table.push('</tbody></table>');
$(container).html(table.join(''));
}
});
Code:
$(function(){
$('#dg').datagrid({
view:myview
});
});
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!