Problem with row selection after sort
#1
Posted 18 May 2006 - 05:45 PM
Sorting via clicking a column header work well, however, the currently selected row does not retain selection after the sort. It is highlighted as though it is, but it's old row index is the one actually selected. Is there some way of fixing this annoying behaviour?
Best regards
Steve
#2
Posted 24 May 2006 - 05:33 AM
I really like your components, but on occasions I need help or feedback implementing them. Unfortunately it seems like a 50/50 chance of getting a timely reply on the forum.
#3
Posted 24 May 2006 - 12:44 PM
I have made this behaviour by design, but I may add option that selection "follow" row after sorting.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#4
Posted 24 May 2006 - 03:56 PM
Thanks for the reply!
> I have made this behaviour by design, but I may add option that
> selection "follow" row after sorting.
IMO the current behaviour is unintuitive, .. sorting should never move the record pointer to a different data record. The row index will most likely change, but the selected record should remain selected after a sort.
#5
Posted 24 May 2006 - 04:05 PM
I will add this feature for sure.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#6
Posted 24 May 2006 - 04:10 PM
Thanks, I will look forward to it!
#7
Posted 30 May 2007 - 09:31 PM
unfortunately this does also happen after moving rows. Is there any solution ?
#Thanks.
#8
Posted 30 May 2007 - 10:41 PM
First issue is fixed, but I don't understand new problem
If you move row with mouse, selected row is automatically selected. If you please can send me some more details, I will like to help.
PS. If you use MoveRow method , you may simply update SelectedRow after calling MoveRow.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#9
Posted 31 May 2007 - 02:38 AM
I allowed two methods for moving rows. First is the drag n' drop row moving, not a single problem. The 2nd method is MoveRow via popmenu entry. Once you moved one entry up or down, the selection moved with the item, okay - but try to select another row now, in the end you can mark all rows by moving them and try to select another row after that event.
(Image - one row moved, another one selected after that event) ..
Thanks.
Bye.
#10
Posted 31 May 2007 - 03:16 AM
Please try next example:
1) Add NextGrid on form and set aoHideSelection in AppearanceOptions to FALSE.
2) Add 2 text columns
3) Add one TButton, and on click add next code:
4) Add one more button and add next code:
NextGrid1.SelectedRow := NextGrid1.SelectedRow + 1;
5) Run project and select first row. If you click on second button, you may see how row is moved.
As I may see all work fine, I hope that this will help you.
If you have any more questions, please ask me.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#11
Posted 31 May 2007 - 04:05 PM
Thanks a lot, this one works very well. I was some kind a confused that time, stupid error.
Bye bye
#12
Posted 15 June 2007 - 02:08 PM
there is similar problem with selecting rows with changing rowvisible settings.
mygrid contains a full data set that will be changed according to user selection. There is another control that will trigger the updategrid() method.
procedure TForm.updategrid();
var
i: Integer;
begin
with mygrid do
begin
// update row filter
for i := 0 to RowCount -1 do
begin
RowVisible[i] := AnsiSameText('Show this row in grid', CellByName[1, i].AsString);
end;
SelectedRow := 0;
// the first row will be not not selected , theres no rowindicator
I just want to have selected the first row of mygrid.
Thanks in advance,
Justus
#13
Posted 15 June 2007 - 02:20 PM
You may try with calling method SelectFirstRow. It is just added in v4.
Please tell me if this work.
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
#14
Posted 15 June 2007 - 02:24 PM
sorry for my dishevelment!!!!
I just found a bug in my code, so that now the rowfocus indicator is shown, but the selected row is not colored blue.
The reason might be that the selectedrow is always set to 0.
So is there a possibilty to force the coloring of the selected row?
TIA! and I will better prepared the next time I post!
Best regards,
Justus
#15
Posted 15 June 2007 - 02:27 PM
No problem
You may set SelectionColor to desired color. Or in OnColoringCells event, add similar code:
begin
CellColor := clRed;
end;
regards
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











