Jump to content


Photo

Sorting: Cell1.ColIndex not correct


  • Please log in to reply
2 replies to this topic

#1 bertrod

bertrod
  • Members
  • 98 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
  • 98 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
  • 7,926 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
Members Section: bms.bergsoft.net
Articles and Tutorials: dn.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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users