zfdatagrid / grid

A DataGrid library for Zend Framework
BSD 3-Clause "New" or "Revised" License
10 stars 16 forks source link

Allow content in setSqlExp #898

Open widgetinc opened 8 years ago

widgetinc commented 8 years ago

If I have a table and I want a styled aggregate row at the bottom I can use (for example):

$grid->setSqlExp (array ("rowname", array ("functions" => array ("sum"), "class" => "mystyles")));

But if I have a column that is text and one that is a number and I only want to aggregate the number field and leave the total field blank (or put some other text in it) then I have to use:

$grid->setSqlExp (array ( "textrow1", array ("functions" => array ("sum"), "decorator" => "", "class" => "mystyles"), "textrow2", array ("functions" => array ("sum"), "decorator" => "Static Text", "class" => "mystyles"), "numrow", array ("functions" => array ("sum"), "class" => "mystyles") ));

This makes the "functions" condition entirely irrelevant. It would be nicer if I could omit that field or, even better, define a "content" field and, if I want the field blank, omit the "decorator" field, too, like this:

$grid->setSqlExp (array ( "textrow1", array ("class" => "mystyles"), "textrow2", array ("content" => "Static Text", "class" => "mystyles"), "numrow", array ("functions" => array ("sum"), "class" => "mystyles") ));

Or am I doing it wrong?