|| | |||Browse by category|
How can I change the grid data from the document when no grid view is attached to it?
We recommend changing all data by using the command methods provided by CGXGridView (SetStyleRange, RemoveRows, ....).
Sometimes there are situations where you want to modify the data directly. Then you can call the CGXData methods: StoreStyleRowCol(), StoreRemoveRows(), etc. directly. Take a look at the CGXData reference for more information.
If you want to initialize the CGXData object from within your document before a view is attached to the document, do the following steps.
On creation of a document:
Create a 'new CGXGridParam' object in the document's constructor
Create a 'new CGXData' object and attach it to the parameter object by calling SetData(new CGXData).
When a new document is created, you can directly assign data to the data-object (CGXData has StoreStyleRowCol() method).
When a document is opened, you can serialize the data-object from the document through its Serialize()method.
On the creation of a view:
Set the grid specific options like the number of header rows, etc.
Set the captions, dropdown lists, and styles for all the cells
The grid will automatically load and store data in the CGXData object you attached to CGXGridParam.