PDA

View Full Version : iconCellrenderer custom datagrid class not showing multi line code


clem_c_rock
02-14-2005, 05:21 PM
Hello,

I'm trying to make a custom cellrendering class for a datagrid that will feature multiline text and html code.

I'm having trouble with this code displaying multiline text:


class HyperlinkCell extends UIComponent
{
static var symbolName:String = "HyperlinkCell";

var text_txt : TextField;
var owner; // the row that contains this cell
var listOwner ; // the List/grid/tree that contains this cell
private var cellData:Object;

// empty constructor
function HyperlinkCell(){}

function createChildren():Void
{
var c = createLabel("text_txt", 14);
c.styleName = listOwner;
c.selectable = false;
c.tabEnabled = false;
c.background = false;
c.multiline = true;
c.wordWrap = true;
c.html = true;
}

function size():Void { var c = text_txt; c._width = __width; c._height = __height; }

function getPreferredHeight():Number{ return 22; }

function setValue(suggested:String, item:Object, selected:Boolean):Void
{
var t:TextFormat = text_txt.getTextFormat();
var nt:TextFormat = text_txt.getNewTextFormat();
text_txt.htmlText = suggested ;
text_txt.setTextFormat(t);
text_txt.setNewTextFormat(nt);
}

private function onHyperlinkClick():Void
{
listOwner.dispatchEvent( {type: "hyperlinkClick", target: listOwner, cell: this, text: cellData} );
}

}



I'm populating the data grid using this simple method:


a = new Array();
a.push( { label:"<li>duh*", link:"<li> Eric is the smartest programmer it's true ljlklk adfdsffa!" } );
a.push( { label:"<li>duh2", link:"<li>duh2 <li>" } );

dg.dataProvider = a;


Any Ideers?