Jump to content


Photo

Sorting: Cell1.ColIndex not correct


  • Please log in to reply
6 replies to this topic

#1 bertrod

bertrod
  • Members
  • 101 posts
  • Gender:Male
  • Location:Switzerland

Posted 19 November 2020 - 01:47 PM

Hi,

 

I want to use a custom sorting on a column, but in the function OnCellCompare() the value of Cell1.ColIndex and Cell2.ColIndex do not correspond to the NxColumn6.Index. 

 

Is there a way to find the column based on the INxCell?

 

Thank you!



#2 bertrod

bertrod
  • Members
  • 101 posts
  • Gender:Male
  • Location:Switzerland

Posted 25 November 2020 - 04:08 PM

I was a bit struggling with this one, but I found a solution by using the Cell1.ComputedLocation:

 

procedure TfrmMain.NxGrid6CellCompare(Sender: TObject; Cell1,
  Cell2: INxCell; var Compare: Integer);
begin
  if Cell1.ComputedLocation.X = NxTextColumn.Position then begin
    ...


#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 25 November 2020 - 05:02 PM

Hi,

 

I didn't have yet time to see why it failed in first case. I will try it today, in meanwhile you can use ComputedLocation even though is slower.


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 aboisrame

aboisrame
  • Members
  • 17 posts

Posted 27 October 2023 - 10:36 AM

Hello,

 

 I still have the same problem with NextSuite 9.2023

.CollIndex doesn't give the good value but it's the same problem with .RowIndex. So it's a bit difficult to know what I need to compare. At the moment I need to analyse the string in the cell, to cut it in small pieces to make my own sort but it's not a good method.

Do you plan to correct those problems ?

 

Thank you for your answer

Alexandre Boisramé



#5 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 27 October 2023 - 10:57 AM

Hello Alexandre,

 

Please just use ComputedLocation property of the cell.

 

I hope this helps.


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 aboisrame

aboisrame
  • Members
  • 17 posts

Posted 27 October 2023 - 12:33 PM

Hello Alexandre,

 

Please just use ComputedLocation property of the cell.

 

I hope this helps.

 

I will do it but it's not obvious that ComputedLocation.X gives .ColIndex and ComputedLocation.Y gives .RowIndex :)

Have a good day

Alexandre Boisramé



#7 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 27 October 2023 - 02:01 PM

Hello,

 

Yes, Y parameter gives a row index. I will also write this inside the documentation.


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