วันศุกร์ที่ 26 สิงหาคม พ.ศ. 2554

cxGrid : How to create a Level/View programmatically at runtime

// Delphi code
var
  Grid: TcxGrid;
  Level: TcxGridLevel;
  View: TcxGridDBTableView;
...
  // Creates a Grid instance
  Grid := TcxGrid.Create(SomeOwner);
  Grid.Parent := SomeParent;
  // Creates a Level
  Level := Grid.Levels.Add;
  Level.Name := 'SomeLevelName';
  // Creates a View
  View := Grid.CreateView(TcxGridDBTableView) as TcxGridDBTableView;
  View.Name := 'SomeViewName';
  // ... and binds it to the Level
  Level.GridView := View;
  // Hooks up the View to the data
  View.DataController.DataSource := SomeDataSource;
  // ... and creates all columns
  View.DataController.CreateAllItems;
end;


Copy from :  http://www.devexpress.com/Support/Center/KB/p/A295.aspx

ไม่มีความคิดเห็น:

แสดงความคิดเห็น