According this topic: http://www.devexpress.com/Support/Center/Question/Details/A302
But GetSelectedCount always returns zero;
If i set DataModeController.GridMode:=True during initialization, it return correct number of selected lines.
But i cannot arrage columns by clicking on column's header.
Is there any way to retrive all recorcds from all lines selected without writing custom filters ?
DelphiProcedure MyClass.ShowMsg;
var
S:String;
I,X:Integer;
ctr:TcxGridDBDataController;
begin
ctr:=(self.View as TcxGridDBBandedTableView).DataController;
ctr.DataModeController.GridMode:=True;
for i:=0 to ctr.GetSelectedCount-1 do
begin
Bkm := ctr.GetSelectedBookmark(I);
if Ctr.DataSet.BookmarkValid(TBookmark(Bkm)) then
begin
ctr.DataSet.GotoBookmark(TBookmark(Bkm));
for x:=0 to ctr.DataSet.FieldCount-1 do
S:=S+'@'+ctr.DataSet.Fields[x].FieldName+' = '+ varToStr(ctr.DataSet.Fields[x].AsVariant)+#13;
end;
end;
Showmessage(S);
ctr.DataModeController.GridMode:=False;
end;
Hello Valery,
I've created a simple project with using the GetSelectedCount method with the enabled and disabled Grid mode and it works as expected.
Please modify my sample to demonstrate the issue and provide us with an executable file (*.exe).
Thanks for the reply, Mikhail. Example you attached work perfect.
Its seems to be my version of Grid is too old, and setting up gridmode in runtime still disabling columns clicks(or there is something i misunderstood).
Anyway, only solution i found is in code below. Class inheritance was a lot confusing. It was key problem.
procedure MyOwnCxGrid.ShowsRowInfo; var i: integer; Ctr: TcxGridDBDataController; X:Integer; s: String; RecID : Integer; begin s:=''; ctr:=(self.View as TcxGridDBBandedTableView).DataController; for i:=0 to ctr.GetSelectedCount-1 do begin RecID:= ctr.GetRecordId(ctr.GetRowInfo(ctr.GetSelectedRowIndex(i)).RecordIndex); if Ctr.DataSet.Locate(Ctr.KeyFieldNames,RecID,[]) then begin for x:=0 to Ctr.DataSet.FieldCount-1 do S:=S+'@'+ctr.DataSet.Fields[x].FieldName+' = '+ ctr.DataSet.Fields[x].AsString+#13; S:=S+#13; end; end; Showmessage(S); end;
Thank you for informing us that you've found the solution.
Please move your last comment to Answer, so I can approve it.