Ticket T151702
Visible to All Users

How to retrive all values from selected rows(even invisible) ?

created 11 years ago (modified 11 years ago)

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 ?

Delphi
Procedure 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;
Comments (3)
DevExpress Support Team 11 years ago

    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.

      Delphi
      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;
      DevExpress Support Team 11 years ago

        Thank you for informing us that you've found the solution.
        Please move your last comment to Answer, so I can approve it.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.