:: Forum >>

dynamic formats

this is somthing i am trying to work out, wondering if i could get some help.
I get 2 arrays from a server myMasks which has things like "mm-dd-yy, ###,###.##, mm-dd-yy hh:mm:ssam/pm etc.." and myFormats which tells if it should be a number or date format. the goal is to format my grid whitout haveing a big list of if statments. do you see anything wrong with the code here.

it is going through fine formatting numbers and dates but ignoring how they should be formatted, for example (mm-dd-yy, is being formatted as mm-dd-yy hh:mm:ssam/pm)


for(msk = 0; msk < myMask.length;msk++) //format(what format you want, what column you want
    {
        if(myFormat[msk] == "Number")
            var format = new AW.Formats.Number;
        if(myFormat[msk] == "Date")
            var format = new AW.Formats.Date;
        if(format != "")
        {
            format.setTextFormat(myMask[msk]);
            format.setErrorText("");
            format.setErrorValue(0);
            table.setCellFormat(format, msk);
        }
        table.setColumnWidth(myLengths[msk], msk);
    }
Ryan Garabedian
Tuesday, June 3, 2008
I don't see anything wrong - looks correct to me. Maybe the problem is somewhere else?
Alex (ActiveWidgets)
Thursday, June 5, 2008
2 things to get that code working.

1. if(format != "") change to
if(format != null)

2. i was using setCellText for my grid instead of setCellData
Ryan Garabedian
Monday, June 9, 2008

This topic is archived.


Back to support forum

Forum search