Reputation: 70
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.
Upvotes: 1
Views: 3768
Reputation: 29
This Block of Code is working for me:
&Sdt.Remove(&Sdt.IndexOf(&Sdt.CurrentItem))
I use it in an User Event ("Borrar")
Upvotes: 0
Reputation: 36
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
Upvotes: 2