:: Forum >>

The Muppet Returns.

Hi Alex, I downloaded the new version last week and found the real-time model you did for me included. That's great, I hope other people get to use it too.

Now as an extension to that grid, I thougth it would be good to include up and down arrows for market direction. To show direction from the last price in the cell would be brilliant, but I decided to show direction on the day.

You can see my basic grid here:
http://tradition-tokyo.net/ActiveWidgets/examples/old/stock3.htm

Column 5 should show arrows according to column 4.
u = up which is defined in the css as au.png (Up arrow)
d = down which is defined in the css as ad.png (Down arrow)
f = flat which is defines in the css as flat.png (Sideways arrow)

I manually set the arrows in rows 8,9, and 10 to show you the expected outcome.

As you can see I am not getting anything from the funcion call depending upon column 4.

Can you please point me in the right direction.

Many thanks indeed.

Regards

Tee.
Tee
Monday, March 5, 2007
You can use setCellImage() method to assign an image code to the cell. You should also use AW.Templates.ImageText for the columns which display images (see /examples/images - using/).

Modify the cell updating code so that it also assigns image code -

var columns = grid.getColumnIndices();
for (var r=0; r<rowCount;r++){
    for (var i=0; i<columns.length;i++){
        var c = columns[i];
        var v = this.getData(c, r);
        if (v != grid.getCellText(c, r)){
            grid.setCellText(v, c, r);
            highlight(c, r);
        }
    }

    var img = this.getData(4, r); // image code from col-4
    if (img != grid.getCellImage(5, r)){
        grid.setCellImage(img, 5, r); // update image in col-5
    }
}


You also should map your image codes to the actual image files -

.aw-image-u {background:url(au.png) 1px 1px no-repeat}
    .aw-image-d {background:url(ad.png) 1px 1px no-repeat}
    .aw-image-f {background:url(flat.png) 1px 1px no-repeat}
Alex (ActiveWidgets)
Tuesday, March 6, 2007
BTW, you can use these styles for alternating row colors -

.aw-alternate-even {background: #FFFFFF;}
.aw-alternate-odd {background: #CCFFFF;}


http://www.activewidgets.com/grid.howto.rows/alternate-colors.html
Alex (ActiveWidgets)
Tuesday, March 6, 2007
Hi Alex.

Thanks for the response and head-up regarding alternate row colours.
I had read the forum regarding that, but since I am only in testing mode at the moment was too lazy to fix things that worked ;-)

I still haven't got the new code you provided above to work, but was wondering.... I have mapped the image code to the image files both in the html file and in the css sheet. Is this bad practice? Should it only be in one and not the other?

Will reply again when I (hopefully), have a result on the images.

Many thanks and best regards


Tee.
.
Tee
Tuesday, March 6, 2007

This topic is archived.


Back to support forum

Forum search