View Issue Details

IDProjectCategoryView StatusLast Update
0002783JEDI VCL00 JVCL Componentspublic2005-04-01 06:03
ReporteranonymousAssigned Toobones 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionwon't fix 
Product Version3.00 BETA 2 
Target VersionFixed in Version 
Summary0002783: TitleClick to select index results in wrong index.
DescriptionWe often have the primary key as the last field on subsequent keys to make these unique - or fx. having 2 name indexes:

Surname: Fields Surname, Lastname
Lastname: Fields Lastname, Surname

When clicking on the title of a grid the wrong index are selected, because the selector are trying to find the clicked field in any indexes regardles wheither it's the first or second field of an index.
Additional InformationFix:

  function GetIndexOf(AFieldName: string; var AIndexName: string; var Descending: Boolean): Boolean;
  var
    I, FieldNo: Integer;
    IsDescending: Boolean;

  begin
    Result := False;
    FieldNo := 99;
    for I := 0 to IndexDefs.Count - 1 do
    begin
      if (Pos(AFieldName, IndexDefs[I].Fields) > 0) and
         (Pos(AFieldName, IndexDefs[I].Fields) <= FieldNo) then
      begin
        FieldNo := Pos(AFieldName, IndexDefs[I].Fields);
        AIndexName := IndexDefs[I].Name; // best match so far
        IsDescending := (ixDescending in IndexDefs[I].Options);
        Result := True;
        if Descending <> IsDescending then
          // we've found an index that is the opposite direction of the previous one, so we return now
        begin
          Descending := IsDescending;
          Exit;
        end;
      end;
      // if we get here and Result is True, it means we've found a matching index but it
      // might be the same as the previous one...
    end;
  end;
TagsNo tags attached.

Relationships

related to 0002784 resolvedobones Issue 2783 

Activities

anonymous

2005-03-20 03:50

viewer   ~0006745

And another issue that I don't know how to solve:

If the grid is a detail in a master-detail relation - it is possible to click on a title record that misses the MasterFields of the relationship, which results in no records are shown in the grid.

obones

2005-04-01 06:03

administrator   ~0006816

From Fred and Dom:
the sorting function in JvDBGrid is very crappy. I didn't remove it because I thought some people could find a use for it, BUT PLEASE DON'T USE IT (and if you do, don't complain). Use JvDBUltimGrid and its sorting function instead.

Issue History

Date Modified Username Field Change
2005-03-20 03:24 anonymous New Issue
2005-03-20 03:50 anonymous Note Added: 0006745
2005-03-20 22:47 jfudickar Relationship added related to 0002784
2005-04-01 06:03 obones Status new => resolved
2005-04-01 06:03 obones Resolution open => won't fix
2005-04-01 06:03 obones Assigned To => obones
2005-04-01 06:03 obones Note Added: 0006816