|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
TableModel DataCellRenderer in Delphi for PHPHello
I searched the list and I don't see many posts about D4PHP so I'm not sure if this is something any of you will help with. As you may know D4php is an IDE that wraps widgets. I am having a problem with one of them. I have just about got an application ready to roll out that relies heavily on the qooxdoo components for the user interface. The main one is dbgrid which is created as = new qx.ui.table.SimpleTableModel(); The problem: I want my grid columns to display with colors and alignments of left right & center. I am able to do this as the web page initally displays but (depending on the browser) a change to a cell or a page down and for sure an ajax refresh of the grid, the row repaints and the colors stay but the alignment goes back to the default. I am by no means a javaScript programmer but in reading the code the VCL puts out for the grid it looks like we are overriding the defaultDataCellRenderer to do this. This is the code I've found: qx.OO.defineClass("qx.ui.table.EasyDataCellRenderer", qx.ui.table.DefaultDataCellRenderer, function() { this.color=''; this.fontcolor=''; this.alignment=''; this.setUseAutoAlign(true); qx.ui.table.DefaultDataCellRenderer.call(this); }); // overridden qx.Proto._getCellStyle = function(cellInfo) { var html = cellInfo.style; html+=';overflow:hidden;border-bottom:1px solid #F0F0F0;border-right:1px solid #F0F0F0'; if (this.color!='') { html+=';background-color:'+this.color; } if (this.fontcolor!='') { html+=';color:'+this.fontcolor; } if (this.alignment!='') { html+=';text-align:'+this.alignment; } return html; }; Because the color changes stick but the alignment does not I am guessing that we aren't really overriding the entire thing. I have tried it with this.setUseAutoAlign(false); and it works the same way except it doesn't right align numbers. Any help would be appreciated. Thanks Gary edit** I just got to thinking it could be in the usage of datacellrender so here is the snippit from that echo " $this->Name.getTableColumnModel().setColumnWidth($i,$dwidth);\n"; echo " var renderer=new qx.ui.table.EasyDataCellRenderer();\n"; if ($color!='') echo " renderer.color=\"$color\";\n"; //GAN EasyGrid if ($fontcolor!='') echo " renderer.fontcolor=\"$fontcolor\";\n"; // echo " renderer.font.Font(11,$[128]);\n"; if ($alignment!='') { switch($alignment) { case "taLeftJustify": $alignment='left'; break; case "taRightJustify": $alignment='right'; break; case "taCenter": $alignment='center'; break; } echo " renderer.alignment=\"$alignment\";\n"; } echo " $this->Name.getTableColumnModel().setDataCellRenderer($i,renderer);\n"; |
|
|
Re: TableModel DataCellRenderer in Delphi for PHPSolved it.
He/she had missed overwriting qx.Proto.updateDataCellElement |
|
|
Re: TableModel DataCellRenderer in Delphi for PHPHi, I have the same problem and I couldn't Solve it. Could u Show us how solved this problem?
my code is : [ ... DBGrid2.getTableColumnModel().setColumnWidth(0,50); DBGrid2.getTableColumnModel().setColumnWidth(1,100); DBGrid2.getTableColumnModel().setColumnWidth(2,100); DBGrid2.getTableColumnModel().setColumnWidth(3,50); DBGrid2.getTableColumnModel().setColumnWidth(4,150); DBGrid2.getTableColumnModel().setColumnWidth(5,20); DBGrid2.getTableColumnModel().setColumnWidth(6,10); DBGrid2.getTableColumnModel().setColumnVisible(6,false); var newRenderer = new qx.ui.table.EasyDataCellRenderer(); newRenderer.setUseAutoAlign(false); newRenderer.fontcolor = "Red"; newRenderer.alignment = "center"; DBGrid2.getTableColumnModel().setDataCellRenderer(3,newRenderer); ... ] the color change but not the alignment, if I try to change other properties I can, but don't with alignment. its crazy 'couse I can see the alignment at right, but then it change to left itself. Thanks a lot. CarlitosMDQ |
|
|
Re: TableModel DataCellRenderer in Delphi for PHPI have heavily modified dbgrids.inc.php to surface a lot of other features of table. To fix this one I changed function dumpHeaderCode() and added this to it.
//I don't know what any of this is I just removed the alignment/bold/italic from it // overridden qx.Proto.updateDataCellElement = function(cellInfo, cellElement) { var clazz = qx.ui.table.DefaultDataCellRenderer; var style = cellElement.style; var stylesToApply = this._getStyleFlags(cellInfo); var textNode = cellElement.firstChild; if (textNode != null) { textNode.nodeValue = this._formatValue(cellInfo); } else { cellElement.innerHTML = qx.html.String.escape(this._formatValue(cellInfo)); } } Get with me over on http://forums.delphi-php.net/ and I'll point you to my mods. |
|
|
Re: TableModel DataCellRenderer in Delphi for PHPThanks!!!! it's working now!!!! I'll contact u in future friend.
|
| Free Forum Powered by Nabble | Forum Help |