Ticket T165718
Visible to All Users

TcxGrid : StoreToIniFile - RestoreFromIniFile

created 10 years ago

hello,

can we save more cxGrid (single form or more form/frame) in a single file ?

how can we load new columns after "RestoreFromIniFile" ?

thank you

Comments (1)
DevExpress Support Team 10 years ago

    Hello Peter,

    <<can we save more cxGrid (single form or more form/frame) in a single file ?>>
    Yes, you can store several Views to a single file. For this, set the AReCreate parameter of the StoreTo~ method (for example, the StoreToIniFile method) to False and set different TableView Names as the ASaveViewName parameter. I suggest you read the "TcxCustomGridView.StoreToIniFile" and "TcxCustomGridView.RestoreFromIniFile" help topics for more information.

    As for your second issue, I'm afraid it is unclear where you wish to load new columns after the RestoreFromIniFile method is called. Would you please describe this issue in greater detail and in a step-by-step manner? For example:

    1. run the project
    2. click the "Store" button and store grids to the "test.ini" file via the StoreToIniFile method

    Answers

    created 10 years ago

    ok, thank you for your response.

    I have another question :

    what option for :

    1. column "x" exists in the grid
    2. column "x" exists in the INI file
    3. remove the column "x" in the grid program
    4. what option to not display the deleted column "x"

    thank you

      Show previous comments (2)
      DevExpress Support Team 10 years ago

        If you delete the columns and don't wish to see any empty columns after restoring, you can just set the AChildrenCreating parameter of the RestoreFromIniFile method to False.
        As for restoring a deleted column, I suggested you refer to the Q202581 thread, where Ingvar suggested two ways to accomplish this task.

        P.S.: I've created a simple example for you. If your situation is different, please modify it to illustrate the issue.

          hello,
          attach sample modify.

          1. execute EXE
          2. move column "name"
          3. clic "store"
          4. clic "delete column"
          5. clic "restore"
            the column "name" is always present.
            it should not be displayed.
            what is the method to return to the initial state ?
            thank you
          DevExpress Support Team 10 years ago

            Hello Peter,

            <<the column "name" is always present>>
            Do you mean that you have an empty column after restoring? As I wrote in my previous post, if you delete columns and don't wish to see empty columns after restoring, you can just set the AChildrenCreating parameter of the RestoreFromIniFile method to False.

            <<what is the method to return to the initial state ?>>
            If you wish to have the "Name" column instead of the empty one, follow Ingvar's advice from the Q202581 thread:
            The blank column and empty cells appear because Store/Restore procedures work only with the layout of the GridView but not with DataBinding. After restoring, it is necessary to bind the restored Column to the Field in code.
            There are two ways in which to perform this task:
            1. Use the OnGetStoredPreperties, OnGetStoredPropertiesValue and OnSetStoredProperties event handlers of a column to store/restore its DataBinding.FieldName property. Please refer to the "TcxCustomGridTableItem.OnGetStoredProperties
            " article of the ExpressQuantumGrid documentation to learn more about this functionality.
            2. A simpler way is to recreate all view items by calling the DataController.CreateAllItems method and then using the RestoreFromIniFile procedure where the AChildredDeleting property is set to True to delete unnecessary items.

            I've modified my sample to illustrate how you can "fully" restore the "Name" column without restoring it at all. Please take a look at the attachment.

            See also:
            Q422447: Save the caption of the columns in inifile

            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.