DataGrid
| From: | Chris Boget | Date: | Sun, 24 Sep 2006 12:03:30 +0000 |
| Subject: | DataGrid | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-25225@lists.php.net to get a copy of this message | ||
For the most part, DataGrid (coupled with DB_DataObject) is incredibly easy to use. In less than half a dozen lines of code, my query result set is returned in XML format. Very cool.
I am, however, running into a stumbling block. One of my columns is a text field that contains/allows CRLFs, which I need to preserve. Before, when I queried the data manually, I was just able to pass that column on to nl2br() prior to display and all was good. However, I don't see a way to pass the value of a column to a user defined function prior to the datagrid renderer using it. That's fine. So I try to do the replace in my query. I'll just use selectAdd() to select the column, having replaces the CRs with nothing and the LFs with '<br/>'. That works, but not how I expected. When the datagrid renderer (any of them, actually, not just the XML renderer) gets the value of the field, it 'prepares' it in some manner and turns any potential entity character into it's html entity representation. So my "<br/>"s are turned into "<br/>". It seems as if there is no way for me to, effectively, no way for me to perform any formatting (such as nl2br(), or any thing else that might involve entity characters). Is that the case?
I've tried to compensate in my XSL stylesheet but the only real option I could see was wrapping the node value in <pre></pre> tags. Anything else would cause all the text to run together as the CRLFs would not be preserved. But by using <pre>, any paragraph sized block would force the text off the right side of the page and cause the browser to create a horizontal scrollbar. Less than ideal presentation.
Is there any way for me to get around this? Or am I just going to have to scrap my plans on using DataGrid? :(
thnx,
Chris