Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » Elevate Web Builder Technical Support » Support Forums » Elevate Web Builder General » View Thread |
Messages 1 to 10 of 11 total |
Get list of selected Grid rows |
Wed, Oct 19 2016 3:13 PM | Permanent Link |
thomh | Hi,
I have an unbound grid with MultiSelect = True. I select 4 out of 10 rows in the grid. How can I read the values from these 4 rows? Thanks. // Thom |
Wed, Oct 19 2016 3:41 PM | Permanent Link |
Raul Team Elevate | On 10/19/2016 3:13 PM, thomh wrote:
> I have an unbound grid with MultiSelect = True. > I select 4 out of 10 rows in the grid. > How can I read the values from these 4 rows? You have to check if they are selected - see EWB manual for MultiSelect "The SelectedCount property can be examined to find out how many rows are selected and the Selected property can be examined to find out which rows are selected." Basically loop thru rows : simple sample below shows value from 1st column: for i := 0 to MyGrid.rowcount-1 do begin if MyGrid.Selected[i] then begin showMessage('Row '+inttostr(i) + ' selected. Col1 Value = ' + MyGrid.Rows[i][0]); end; end; Raul |
Wed, Oct 19 2016 4:05 PM | Permanent Link |
thomh | Thanks, Raul.
And if I wanted to delete these 4 selected rows from the grid? // Thom |
Wed, Oct 19 2016 4:11 PM | Permanent Link |
Trinione | thomh:
<< And if I wanted to delete these 4 selected rows from the grid? >> Same approach. for i := 0 to MyGrid.rowcount-1 do begin if MyGrid.Selected[i] then MyGrid.DeleteRow; end; |
Wed, Oct 19 2016 4:31 PM | Permanent Link |
thomh | Hi,Trinione.
I got 5 rows in the grid. With your code: If I select row 2 and 3, only row 3 is deleted. If I select row 4 and 5, only row 5 is deleted. If I select all 5 rows, row 5 is deleted and I get an error: "List index 4 out of bounds". // Thom |
Wed, Oct 19 2016 4:41 PM | Permanent Link |
Walter Matte Tactical Business Corporation | DOWNTO
for i := MyGrid.rowcount-1 downto 0 begin if MyGrid.Selected[i] then MyGrid.DeleteRow; end; Walter |
Thu, Oct 20 2016 1:43 AM | Permanent Link |
thomh | Hi Walter,
I got 5 rows in the grid. Using DOWNTO: If I select row 1, 2 and 3, row 3, 4, 5 is deleted. If I select row 2 and 3, row 4 and 5 is deleted. If I select row 4 and 5, row 5 is deleted and I get error: "List index 4 out of bounds". // Thom |
Thu, Oct 20 2016 2:18 AM | Permanent Link |
thomh | Using SetToRow to update the RowIndex before DeleteRow seems to work.
// Thom |
Thu, Oct 20 2016 4:11 AM | Permanent Link |
Walter Matte Tactical Business Corporation | Good information - thanks for letting us know.
Walter thomh wrote: Using SetToRow to update the RowIndex before DeleteRow seems to work. // Thom |
Thu, Oct 20 2016 4:58 AM | Permanent Link |
thomh | Further testing revealed some wonky results using SetToRow depending on which records I select.
Seems you need set the SetToRow ShiftKey and CtrlKey parameters appropriately. For me it works well when I use SetToRow(i, False, True). // Thom |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Thursday, March 28, 2024 at 08:36 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |