View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002784 | JEDI VCL | 00 JVCL Components | public | 2005-03-20 04:36 | 2005-04-01 06:04 |
Reporter | cab-dk | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | won't fix | ||
Product Version | 3.00 BETA 2 | ||||
Target Version | Fixed in Version | ||||
Summary | 0002784: Issue 2783 | ||||
Description | I'm the reporter and I have a solution on the doTitleClick | ||||
Additional Information | procedure TJvDBGrid.DoTitleClick(ACol: Longint; AField: TField); const cIndexName = 'IndexName'; cIndexDefs = 'IndexDefs'; cMasterFields = 'MasterFields'; cDirection: array [Boolean] of TSortMarker = (smDown, smUp); var IndexDefs: TIndexDefs; LIndexName: string; Descending: Boolean; IndexFound: Boolean; function GetIndexOf(AFieldName: string; var AIndexName: string; var Descending: Boolean): Boolean; var I, FieldNo: Integer; IsDescending: Boolean; MasterFields: string; begin Result := False; FieldNo := 99; if IsPublishedProp(DataSource.DataSet, cMasterFields) then MasterFields := GetStrProp(DataSource.DataSet, cMasterFields); if MasterFields <> '' then MasterFields := MasterFields + ';'; for I := 0 to IndexDefs.Count - 1 do begin if (Pos(MasterFields + AFieldName, IndexDefs[I].Fields) > 0) and (Pos(MasterFields + AFieldName, IndexDefs[I].Fields) <= FieldNo) then begin FieldNo := Pos(MasterFields + 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; begin IndexFound := False; if AutoSort and IsPublishedProp(DataSource.DataSet, cIndexDefs) and IsPublishedProp(DataSource.DataSet, cIndexName) then IndexDefs := TIndexDefs(GetOrdProp(DataSource.DataSet, cIndexDefs)) else IndexDefs := nil; if Assigned(IndexDefs) then begin Descending := SortMarker = smUp; if GetIndexOf(AField.FieldName, LIndexName, Descending) then begin IndexFound := True; SortedField := AField.FieldName; SortMarker := cDirection[Descending]; try SetStrProp(DataSource.DataSet, cIndexName, LIndexName); except end; end; end; //-------------------------------------------------------------------------- // FBC: 2004-02-18 // Following code handles the sortmarker if no Index is found. // the actual data-sorting must be implemented by the user in // event OnTitleBtnClick. //-------------------------------------------------------------------------- if AutoSort and not IndexFound then begin if SortedField = AField.FieldName then begin case Self.SortMarker of smUp: Self.SortMarker := smDown; smDown: Self.SortMarker := smUp; end; end else begin SortedField := AField.FieldName; Self.SortMarker := smUp; end; end; if Assigned(FOnTitleBtnClick) then FOnTitleBtnClick(Self, ACol, AField); end; | ||||
Tags | No tags attached. | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2005-03-20 04:36 | cab-dk | New Issue | |
2005-03-20 22:47 | jfudickar | Relationship added | related to 0002783 |
2005-04-01 06:04 | obones | Status | new => resolved |
2005-04-01 06:04 | obones | Resolution | open => won't fix |
2005-04-01 06:04 | obones | Assigned To | => obones |
2005-04-01 06:04 | obones | Note Added: 0006817 |