Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.9.3

Request #3170 Add option for limiting field length
Submitted: 2005-01-11 23:11 UTC
From: justinpatrin Assigned: asnagy
Status: No Feedback Package: Structures_DataGrid
PHP Version: Irrelevant OS: Irrelevant
Roadmaps: (Not assigned)    
Subscription  


 [2005-01-11 23:11 UTC] justinpatrin
Description: ------------ This patch limits the length of cell content to a certain length (set to 200 for now). It also includes JavaScript so that when clicked the content expands to the full version. Upon clicking again the content goes back to the short version. This isn't a full patch yet, but it works. I wanted to get it in here before I forgot. This should definately be an option, not the default. This also doesn't take HTML into account so if there's HTML in a cell this will truncate it (and cause interesting things to happen...). http://www.reversefold.com/PEAR/S_DG_R_HT_content_limit.patch

Comments

 [2005-01-18 19:27 UTC] asnagy at webitecture dot org
I think this is too over-the-top to be in the main class. Maybe this might be a nice as a seperate column class, for example: Structures_DataGrid_Column_ContentLimit
 [2005-01-18 19:35 UTC] justinpatrin
Ah....I've never used the columns, so I didn't know about them. The one problem I see is that if I want to specify one column I have to specify them *all*. I'd rather be able to change the auto-generated columns. Would it be possible to have the auto-generated columns created before rendering so that the user can futz with them?
 [2005-01-21 21:44 UTC] asnagy at webitecture dot org
Boy you are lazy! :) The addColumn method was created so that you can define your own columns. This method is the work around to allow the app developer to futz with the columns, it just won't create them for you. You could call the private method that does the auto-generation before calling render so you can modify them if you want. You want the cake and to eat it too!?
 [2005-01-21 23:05 UTC] justinpatrin
Heh, sorry, I've been spoiled by FormBuilder. I should alter my code to create the columns anyway. ;-) I may try that limiting column thing....when I get soem more free time. For now, my alterations to the renderer.
 [2005-03-04 19:25 UTC] justinpatrin
Ok, I've finally made this into an add-on component (took me long enough ;-). I have it done in two different ways: The first is as a new Column. This seems like the simplest way of using it and should be easily includable into the SDG package. I had to use a global array to deal with user-specified formatters (but they fully work ;-) as I couldn't figure out a beter way to do it since the formatter syntax doesn't allow array(&$this, 'function') as normal callbacks do. You also must specify the field name for this kind of column. http://www.reversefold.com/PEAR/SDG_LimitColumn.phps I also have it as a single funciton which can be used as a formatter. This version is easily includable intot anyone's scripts but requires a little more work (and typing) whens etting up the columns. I think the above class is much more useful, but I made this one first so I'm including it as well. http://www.reversefold.com/PEAR/SDG_limitRenderer.phps
 [2005-04-05 17:58 UTC] justinpatrin
Argh... I lost my server a while ago so the code was lost. If anyone has a copy of either of these files, please let me know. Here's a link to what I think is an up to date version of the LimitColumn class: http://formbuilder.reversefold.com/SDG_LimitColumn.phps
 [2005-07-13 16:49 UTC] asnagy
I feel this request is outside the scope of SDG. The proposed column will only work with the HTML renderer due to the use of JavaScript. If you feel it could make a worthy addition to SDG, I would suggest removing the JavaScript so that other renderers could utilize it. Or, make a new renderer based on the HTML renderer.
 [2005-07-15 17:07 UTC] justinpatrin
True, this column will only work with HTML. However there's no way for the column (or a formatter period for that matter) to know what renderer is being used. I originally implemented this in the HTML renderer but you shot that down as well. I *could* implement a new renderer for this but that's overkill as there's no way to extend the current renderer without copying pretty much all of the code in _buildHTMLTableBody.
 [2006-03-01 22:57 UTC] olivierg at php dot net
The renderer layer has gone through a long refactoring process (see the CVS) related to Bug #5859. The HTML table driver is now easier to extend, this monolithic _buildHTMLTableBody() method you talk about is definitely gone. Can you do what you need by overloading the Structures_DataGrid_Renderer_HTMLTable::defaultCellFormatter() method in a child class ? This method is used to format all cells values (including header and footer cells). But it is not used for columns with a user-provided formatter.
 [2006-06-26 12:37 UTC] wiesemann (Mark Wiesemann)
No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. --- (I assume that Olivier's suggestion helps you.)