Jump to content


Photo

Problem with row selection after sort


  • Please log in to reply
14 replies to this topic

#1 ozmosys

ozmosys
  • Members
  • 19 posts
  • Location:Melbourne, Australia

Posted 18 May 2006 - 05:45 PM

Hi Boki,

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 ozmosys

ozmosys
  • Members
  • 19 posts
  • Location:Melbourne, Australia

Posted 24 May 2006 - 05:33 AM

Hi Boki,

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. sad.gif IMO (and I apply these rules personally on my own user support forum) ALL posts should be acknowledged within a day of the original posting, and then answered ASAP after that.
Best regards

Steve

http:\\www.ozmosys.net.au

#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 24 May 2006 - 12:44 PM

Hello Steve,

I have made this behaviour by design, but I may add option that selection "follow" row after sorting.

regards
boki@bergsoft.net | LinkedIn Profile
--
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 ozmosys

ozmosys
  • Members
  • 19 posts
  • Location:Melbourne, Australia

Posted 24 May 2006 - 03:56 PM

Hi Boki,

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.
Best regards

Steve

http:\\www.ozmosys.net.au

#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 24 May 2006 - 04:05 PM

Hello,

I will add this feature for sure.

regards
boki@bergsoft.net | LinkedIn Profile
--
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 ozmosys

ozmosys
  • Members
  • 19 posts
  • Location:Melbourne, Australia

Posted 24 May 2006 - 04:10 PM

Hi Boki,

Thanks, I will look forward to it! biggrin.gif
Best regards

Steve

http:\\www.ozmosys.net.au

#7 inqontrol

inqontrol
  • Members
  • 26 posts

Posted 30 May 2007 - 09:31 PM

Hello,

unfortunately this does also happen after moving rows. Is there any solution ?

#Thanks.

#8 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 30 May 2007 - 10:41 PM

Hello Ingontrol,

First issue is fixed, but I don't understand new problem sad.gif

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
boki@bergsoft.net | LinkedIn Profile
--
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 inqontrol

inqontrol
  • Members
  • 26 posts

Posted 31 May 2007 - 02:38 AM

Hi,

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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 31 May 2007 - 03:16 AM

Hello Ingontrol,

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:
CODE
  NextGrid1.AddCells(['Mike','John','Lisa','Jim','Greg','Dona']);


4) Add one more button and add next code:

CODE
  NextGrid1.MoveRow(NextGrid1.SelectedRow, NextGrid1.SelectedRow + 1);
  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
boki@bergsoft.net | LinkedIn Profile
--
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 inqontrol

inqontrol
  • Members
  • 26 posts

Posted 31 May 2007 - 04:05 PM

Hey,

Thanks a lot, this one works very well. I was some kind a confused that time, stupid error.

Bye bye smile.gif

#12 justus

justus
  • Members
  • 36 posts

Posted 15 June 2007 - 02:08 PM

hi,

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.

CODE
// mygrid.options := [goIndicator,goSelectFullRow,...]


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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 15 June 2007 - 02:20 PM

Hello Justus,

You may try with calling method SelectFirstRow. It is just added in v4.

Please tell me if this work.

regards
boki@bergsoft.net | LinkedIn Profile
--
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 justus

justus
  • Members
  • 36 posts

Posted 15 June 2007 - 02:24 PM

Hi again,

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 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,289 posts
  • Gender:Male

Posted 15 June 2007 - 02:27 PM

Hello Justus,

No problem smile.gif

You may set SelectionColor to desired color. Or in OnColoringCells event, add similar code:
CODE
  if csSelected in CellState then
  begin
    CellColor := clRed;
  end;


regards
boki@bergsoft.net | LinkedIn Profile
--
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