Did you see getColumnIndex(name) in the ASDoc?

 

And each DataGridColumn has a columnName property too.

 

Matt

 


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 17,2005 10:44 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [flexcoders] How to reference column name in my code?

 

Hi All,

included is a snippet of code that hides & shows columns in the datagrid.

How do I reference columnName instead of columns[i] ?? I also have code that
switches columns ( thanks Manish ;) ) but when I switch a column my code hided
the wrong column because it is referencing the columns[i] instead of the
columnName.

help would be nice.

thanks,
-Art

// Hide Columns Code:
var initialRender : Boolean = true;
var columns : Array = new Array();
var columnWidths : Array = new Array();

function getAllColumns() {
      if ( initialRender ) {
            for ( var i=0; i < historyDg.columnCount; i++ ) {
                  columns[i] = historyDg.columns[i];
            }
            initialRender = false;
      }
}
function layoutColumns()
{
tabNav_1.selectedChild = details;
var count : Number = 0;
historyDg.removeAllColumns();
if ( wMonthCheck.selected )
{
      historyDg.addColumnAt(count, columns[0]);
      count++;
}
if ( hoursCheck.selected )
{
      historyDg.addColumnAt(count, columns[1]);
      count++;
}
}



Reply via email to