DevExpress Quantum Grid Simple guide

2.5k views Asked by At

I am looking for a practical guide to the DevExpress Quantum Grid.

The manual is 4015 pages long and while it is thorough, it is a big big read with too much detail all at once. I have been resisting this Borg of a grid for years, but now I have finally been assimilated by a work requirement.

I have no help from colleagues here. They are all communication challenged. And in fact they seem to mostly be coping with this tool, not using it well. For example one fellow insists on never using it in bound or server mode. It seems to defeat the purpose to me.

Any help of the 'getting started', or 'for dummies' variety to get me using it as effectively as an ordinary grid would be appreciated. I have found a lot of weird idiosyncrasies with it in insert mode bound. I can't really explain what it does because I dont know enough about how it is trying to work. But when I ask it to insert a row, it tries to insert after one cell has data. Something stupid is going on but I dont know why. There are thousands of settings that it could be, and I am not even sure I have the right controls selected to get me to the right options.

1

There are 1 answers

2
MartynA On

Best place for beginner's help is Devex's website, e.g. https://www.devexpress.com/Support/Center

As I think you've noticed, the problem with the TcxGrid (which is what the Quantum Grid now is) is its plethora of properties, nested properties and so on. Their demos show what the grid can do, but finding your way around the settings that make them work via the Object Inspector is a bit of a nightmare. And of course when you start to play around in the OI, something you do stops it working and retracing your steps can be very hard.

So, I think a good place to get started is a project which creates the grid entirely in code so that everything gets defaults except what you explicitly set in code. As you can see, there is actually very little you need do to get a simple, data-bound, grid working at a basic level.

Try this

type
  TForm1 = class(TForm)
    CDS1: TClientDataSet;
    CDS1ID: TAutoIncField;
    CDS1Marked: TBooleanField;
    CDS1Value: TStringField;
    DS1: TDataSource;
    DBNavigator1: TDBNavigator;
    cxGrid1DBTableView1: TcxGridDBTableView;
    cxGrid1Level1: TcxGridLevel;
    cxGrid1: TcxGrid;
    procedure FormCreate(Sender: TObject);
  public
    cxGrid : TcxGrid;
    cxLevel : TcxGridLevel;
    cxView : TcxGridDBTableView;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
  i : Integer;
begin
  CDS1.IndexFieldNames := 'ID';
  CDS1.CreateDataSet;

  for i := 1 to 5 do begin
    CDS1.Insert;
    CDS1.FieldByName('Marked').AsBoolean := Odd(i);
    CDs1.FieldByName('Value').AsString := 'Value  ' + IntToStr(i);
    CDS1.Post;
  end;

  CDS1.First;

  cxGrid := TcxGrid.Create(Self);
  cxGrid.Parent := Self;
  cxGrid.Width := 250;

  cxLevel := cxGrid.Levels.Add;
  cxLevel.Name := 'Firstlevel';

  cxView := cxGrid.CreateView(TcxGridDBTableView) as TcxGridDBTableView;
  cxView.Name := 'ATableView';

  cxLevel.GridView := cxView;

  cxView.DataController.DataSource := DS1;

  cxView.DataController.CreateAllItems;

end;