1 Reply Latest reply on Feb 8, 2010 10:04 PM by Flex harUI

    Combining client side datagrid functions with server

    Pat Moody

      Hi,

       

      Should it be possible to delete rows from a grid independent of whether they have been saved back to the server or not. Here is an example:

       

      protected function buttonDelete_clickHandler(event:MouseEvent):void
      {
          if (adg1.selectedIndex > -1) {
              if (adg1.selectedItem.obj_uuid.substr(0,15) == "unsaved_closure" ) {
                  adg1.dataProvider.removeItemAt(adg1.selectedIndex);
              }   
              else if (adg1.selectedItem.obj_uuid.length  == 36){
                  closureService.deleteClosure(adg1.selectedItem.obj_uuid);
              }
          }
          else { Alert.show("You need to select a row for deletion");
          }
      }

       

      What is intended here is that there is only one delete function for datagrid rows. The problem I'm having is that if there have been a number of new rows added to the datagrid without committing those changes. When I subsequently choose to delete a row that has been committed (running the 'deleteClosure' function in this example) it appears to be corrupting the client side rows by removing the value assigned to the adg1.selectedItem.obj_uuid and replacing it with item.obj_uuid as its new value. It's only affecting this uniquely defined column an not the others.