Search code examples
gridgenexus

DELETE ROW FROM GRID


I have a webpanel with a grid on it. this grid is linked to a SDT. I've been able to add rows to the SDT, then automatically shows the added rows on the grid. Now I'm trying to delete certain rows. In the event code from the grid's column I've put this code (taken from http://hmquiroz2.blogspot.com/2009/09/eliminar-item-de-sdt-en-genexus.html ):

&Idx = &Sdt.IndexOf(&Sdt.CurrentItem)
&Sdt.Remove(&Idx)
grid1.refresh()  //  added later, trying to update the grid

but the grid remains the same. I've tried adding a grid.refresh() after, with no avail. I've tried changing the "Web User Experience" property from SMOOTH to PREVIOUS VERSIONS COMPATIBLE. No luck neither. Debugging I see that the &SDT.Count property doesn't change.


Solution

  • I use the folowing code to delete an item from a Sdt:

    &Idx = 0
    For &SdtItem in &Sdt
        &Idx += 1
        If &SdtItem.Line = &Sdt.CurrentItem.Line
            &Sdt.Remove(&Idx)
            Exit
        EndIf
    EndFor