Data Grid - Linha selecionada ficar em negrito

1 resposta
A

Bom dia… Estou tentando fazer com que a linha selecionada do DataGrid fique em negrito.
Segue o codigo… Estou tendo como erro:

Acesso de propriedade possivelmente indefinida owner por meio de uma referência com tipo estático Class

<mx:DataGrid id="dtgrdConsulta" dataProvider="{lista}"
				 editable="false"
				 dropEnabled="false" 
				 dragEnabled="true"
				 dragMoveEnabled="false"
				 allowMultipleSelection="true"
				 allowDragSelection="true"
				 left="5" right="5" top="5" bottom="5">
		<mx:columns >
			
			<mx:DataGridColumn headerText="CPF" dataField="cpf" width="80"/>
			<mx:DataGridColumn headerText="Nome" dataField="nome" width="130"/>
			
		</mx:columns>
	</mx:DataGrid>

                                                private function mdiwindow1_creationCompleteHandler(event:FlexEvent):void
			{
				
				dg = ListData.owner as DataGrid;
				dg.addEventListener(ListEvent.CHANGE, updateSelected);

				roTelaConsultaPermissao.CarregaComboUnidades();
			}
			
                                                override public function set data(value:Object):void
			{
				super.data = value;
				
				if(value)
				{
					var dglistData:DataGridListData = ListData as DataGridListData;
					if(value[dglistData.dataField])
						value.text = value[dglistData.dataField];
					updateSelected();
				} 
			}
			
			private function updateSelected(e:Event = null):void
			{
				if(!data || !dg)
					return;
				
				if(dg.selectedItem == data)
				{
					//This row is selected update stuff
					setStyle("fontWeight", "bold");
				}
				else
				{
					//This row is not selected reset stuff
					setStyle("fontWeight", "normal");
				}
			}

1 Resposta

F

Tenta usa a labelFunction do datagrid cada vez que seleciona. Talvez funcione.

Criado 10 de fevereiro de 2011
Ultima resposta 10 de fev. de 2011
Respostas 1
Participantes 2