PDA

View Full Version : DataGrid customization woes...


sfungus
07-23-2004, 08:21 AM
First off, this is Flash MX 2004... I've tried any and all combinations to attempt to get rid of the white gradient occuring on the headers for my DataGrid, and nothing is working. Here's what I've got going on:

grid.setStyle("vGridLineColor", 0xE2202B);
grid.setStyle("hGridLineColor", 0xE2202B);
grid.setStyle("headerColor", 0xE2202B);
grid.borderColor = 0xE2202B;
grid.backgroundColor = 0xE2202B;
grid.setStyle("fontSize", "9");
grid.borderStyle = "none";
grid.useRollOver = false;
grid.setStyle("headerColor", 0xE2202B);
grid.headerStyle.setStyle("fontSize", "11");
grid.headerStyle.setStyle("fontWeight", "bold");
grid.headerStyle.setStyle("color", 0xFFFFFF);

All of this looks great, but I can't get rid of the white gradient running from the bottom up on the header. From what I can tell, it's a highlightColor issue, but I've tried setting the highlightColor to 0xE2202B in a 1000 different ways, none of which work. Any help would be appreciated.

Also, I'm experiencing some difficulty setting column widths... where does this need to occur? When the grid is being created, or when a column is being created?

thanks!

Knieval
07-29-2004, 09:36 PM
Hi,

I've also been trying things out with the Flash MX 2004 datagrid. I can't help you to lose the white gradient unfortunately, but I can tell you how to set the column widths. Pretty simple actually:

grid.getColumnAt(0).width = value;
grid.getColumnAt(1).width = value;
grid.getColumnAt(n).width = value;

Just fill in the index of the column and the number of pixels in value as large as the width should be. I've experienced that you should edit the widths after you've filled the grid with data.

Hope this helps you!

Greets

kAd
07-30-2004, 12:44 AM
take a look to

http://philflash.inway.fr/dgstyle2/dgstyle2.html

and

http://philflash.inway.fr/dgstyle/dgstyle.html

its in french, but you can use a translation service....

clem_c_rock
07-30-2004, 02:32 PM
Hello,

Here's some things to try:

list_grd.setStyle("hGridLines", true);
list_grd.setStyle("hGridLineColor", 0xC1D1E0);
list_grd.setStyle("vGridLines", true);
list_grd.setStyle("vGridLineColor", 0xC1D1E0);
list_grd.setStyle("borderStyle", "inset");
list_grd.setStyle("buttonColor", 0xFFFFFF);
list_grd.setStyle("highlightColor", 0xFFFFFF);
list_grd.setStyle("borderCapColor", 0xFFFFFF);
list_grd.setStyle("shadowCapColor", 0xFFFFFF);
list_grd.setStyle("shadowColor", 0x336699);
list_grd.setStyle("borderColor", 0xFFFFFF);

grizjr
08-01-2004, 11:37 PM
This is sad but true, but there is no easy way of removing the white gradient. Customizing the datagrid set me back 2 weeks when I finally just gave up. I recommend you get out while you still can and make your own datagrid with duplicatemovieclip. It might seem like its hard and time consuming but the end result is much quicker than trying to customize that damn thing.

Also, when I had the grid in my library, compiling time was considerably longer, when I took it out it was a big relief.

James

sfungus
08-03-2004, 03:19 AM
I finally opted just to turn off the headers completely and make my own in the movie itself. Stupid, stupid, stupid macromedia.

theflux
08-03-2004, 09:47 AM
I am having my own problems with the DataGrid, like not being able to set the selected item with actionscript while the DataGrid is not editable. You would think that would be a simple task, like it is for the VB6 Grids, but you would be wrong. Is there a fair priced commercial component (or better yet a free one)?

blueskies
08-24-2004, 07:12 AM
To remove gradient from header on global basis, you will need to comment out the following code in DataGrid.as [you will need MX 2004 Pro]:

//mc.beginGradientFill("linear", colors, alphas, ratios, matrix);

//mc.lineStyle(0, 0x000000, 0);
//mc.lineTo(tot, o.top);
//mc.lineTo(tot, __headerHeight+1);
//mc.lineStyle(0, 0x000000, 100);
//mc.lineTo(o.left, __headerHeight+1);
//mc.lineStyle(0, 0x000000, 0);
//mc.endFill();

Then, you will need to open up StandardComponents.fla. You will need to change classpath to [your hard drive\Macromedia\Flash MX 2004\en\First Run\Classes] - my default path was wrong when I opened it.

Highlight the DataGrid component in document library. Right click and choose 'Convert to Compiled Clip'. You can rename to whatever you like [DataGrid SWF].

Drag and drop new compiled component to the Stage of your movie. As usual, you should use setStyle to change headerColor, etc. i.e. setStyle("headerColor", 0x000000);

Enjoy.

fishmonger
09-20-2005, 09:27 PM
mx.controls.DataGrid.prototype.drawHeaderBG = function(Void) {
var mc:MovieClip = this.header_mc;
mc.clear();
var clr:Number = this.getStyle("headerColor");
var o:Object = this.__viewMetrics;
var tot:Number = Math.max(this.totalWidth, this.displayWidth+3);
mc.moveTo(o.left, o.top);
mc.beginFill(clr, 100);
mc.lineStyle(0, 0x000000, 0);
mc.lineTo(tot, o.top);
mc.lineTo(tot, this.__headerHeight+1);
mc.lineStyle(0, 0x000000, 0);
mc.lineTo(o.left, this.__headerHeight+1);
mc.lineStyle(0, 0x000000, 0);
mc.endFill();
};
//custom header

found this script around google, works like a charm for solid headers.