开发者

Selecting and Setting Style to DataGridColumn after passing the DataProvider

I have a Datagrid thats being populated by different Arrays... (headers/columns change for the same DataGrid)...

I would like to Select a Column of the Datagrid after it was generated by the Dataprovider and Bold it, and place it as the 'last column"

This is what I have.... and throwing an error:

private function populateGrid(evt:Object):void {
 dg.dataProvider = evt as Array;
 if (dg.columns.length > 0) {
      for (var i:int = 0; i < dg.columns.length; i++) {
           if (dg.columns[i].dataField == '_user_total') {
                DataGridColumn((dg.columns[i].dataField)).setStyle('fontWeight', 'bold');
           }
      }
 }

}

This way I would like to have One Datagrid (for different Arrays) )without having the Columns fixed and declared (like in MXML), but dynamic, and would like a 'specific' column to be Bo开发者_JS百科lded, and placed as the last column, in this example, the column with dataField _user_total.


private function populateGrid(evt:Object):void {
 dg.dataProvider = evt as Array;
 if (dg.columns.length > 0) {
      for (var i:int = 0; i < dg.columns.length; i++) {
           if (dg.columns[i].dataField == '_user_total') {
                (dg.columns[i]).setStyle('fontWeight', 'bold');
           }
      }
 } 

}

So the code above does it for me

After finding the Column in question dynamically... we bold it!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜