Foi o q fiz (conforme primeira postagem)

public function onResultExcluir(event:ResultEvent):void    {
//    listCursos.removeItemAt(idxSelected);
//    idxSelected = -1;
//    cursoSelected = null;
    Alert.show("Curso excluído.");
    getCursos();
}


2009/10/11 Marcelo Caser <marceloca...@gmail.com>

> chame seu metodo de listagem novamente, apos excluir!
>
> 2009/10/11 Leonardo Ribeiro <leojribe...@gmail.com>
>
> Srs,
>>
>> Fiz uma listagem simples com um DataGrid e uns botoes (inserir, alterar,
>> excluir) no momento estou testando apenas o Excluir.
>> A exclusao funciona perfeitamente (no banco) porém o datagrid nao atualiza
>> (continua com todos os registros de antes da exclusao).
>> Abaixo segue o mxml e o as.
>>
>> <?xml version="1.0" encoding="utf-8"?>
>> <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml";
>> layout="absolute" width="576" height="346" title="Cursos"
>> showCloseButton="true" creationComplete="init();" alpha="1.0">
>>     <mx:DataGrid x="10" y="10" width="419" height="286" id="dgCursos"
>> dataProvider="{listCursos}"
>>                  itemClick="dgCursoItemClick(event);">
>>         <mx:columns>
>>             <mx:DataGridColumn headerText="Código" width="50"
>> dataField="codigo"/>
>>             <mx:DataGridColumn headerText="Nome" width="100"
>> dataField="nome"/>
>>         </mx:columns>
>>     </mx:DataGrid>
>>     <mx:Button x="442" y="11" label="Novo" width="101" id="btnNovo"
>> click="novo();"/>
>>     <mx:Button x="442" y="41" label="Alterar" width="101" id="btnAlterar"
>> click="alterar();"/>
>>     <mx:Button x="442" y="71" label="Excluir" width="101" id="btnExcluir"
>> click="excluir();"/>
>>     <mx:Button x="442" y="274" label="Fechar" width="101" id="btnFechar"
>> click="fechar();"/>
>>
>>     <mx:RemoteObject id="cursoService" showBusyCursor="true"
>> fault="onFault(event)" destination="cursoService">
>>         <mx:method name="getCursos" result="onResultGetCursos(event)"
>> fault="onFault(event)"/>
>>         <mx:method name="excluir" result="onResultExcluir(event)"
>> fault="onFault(event)"/>
>>     </mx:RemoteObject>
>>
>>     <mx:Script source="cursoLst.as"/>
>>
>> </mx:TitleWindow>
>>
>>
>>
>> AS
>>
>> [Bindable]
>> private var listCursos:ArrayCollection;
>> private var cursoSelected:Curso;
>> private var idxSelected:int = -1;
>>
>> private function init():void {
>>     getCursos();
>> }
>>
>> private function novo():void {
>>
>> }
>>
>> private function alterar():void {
>>
>> }
>>
>> private function excluir():void {
>>     if (idxSelected > -1 && idxSelected <= listCursos.length - 1 &&
>> cursoSelected != null) {
>>         cursoService.excluiCurso(cursoSelected);
>>     } else {
>>         Alert.show("Selecione um Curso para excluir.");
>>     }
>> }
>>
>> public function onResultExcluir(event:ResultEvent):void    {
>> //    listCursos.removeItemAt(idxSelected);
>> //    idxSelected = -1;
>> //    cursoSelected = null;
>>     Alert.show("Curso excluído.");
>>     getCursos();
>> }
>>
>> private function dgCursoItemClick(event:ListEvent):void {
>>     idxSelected = event.rowIndex;
>>     cursoSelected = listCursos.getItemAt(idxSelected) as Curso;
>> }
>>
>> private function fechar():void {
>>     PopUpManager.removePopUp(this);
>> }
>>
>> public function getCursos():void {
>>     Alert.show("getCursos()");
>>     cursoService.getCursos(true);
>> }
>>
>> public function onResultGetCursos(event:ResultEvent):void    {
>>     Alert.show("Pegou Cursos.");
>>     listCursos = event.result as ArrayCollection;
>> }
>>
>> public function onFault(event:FaultEvent):void {
>>     Alert.show(event.fault.message);
>> }
>>
>>
>> O fonte ta beeem simples, apos excluir mando pegar os cursos de novo e a
>> listCursos esta como dataProvider do DataGrid.
>> Alguem sabe o que estou fazendo de errado?
>>
>> --
>> []'s
>> Leonardo
>>
>> Linux User #488650
>> Ubuntu User #27045
>> Mais sobre o Ubuntu em português: http://www.ubuntu-br.org/comece
>>
>>
>>
>
> >
>


-- 
[]'s
Leonardo

Linux User #488650
Ubuntu User #27045
Mais sobre o Ubuntu em português: http://www.ubuntu-br.org/comece

--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para flexdev@googlegroups.com
Para sair da lista, envie um email em branco para 
flexdev-unsubscr...@googlegroups.com
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---

Responder a