Hi,
when I load a grid layout with LoadFromXml(), and the layout contains a column with a ValueList, the dropdown list does not appear.
You see the down-arrow button of the combobox in the cell, but there are no items.
I have to manually set the ValueList property for the column again to see the values of the list.
This also happens when using a BindableValueList.
Is this a bug or did I do anything wrong?
Thanks for your help.
How are you creating your ValueLists and how you are attaching them to the grid?
I'm not sure, but the grid might not be able to save the ValueList along with the grid layout unless you add it to the grid.DisplayLayout.ValueLists collection.
For example, I create the ValueList this way:
This works normally.
If I save and load the grid layout, the ValueList is not assigned to the column any more.
I ran your sample and I do not get the results you describe. You are correct in that the ValueListItems should be appearing in the grid after Step 5, and when I run your sample, they do show up just fine for me.
I don't see how they could possibly not be showing up simply from stopping and re-running the project. Since the "test.xml" file does not exist, it never gets loaded and therefore nothing has changed. My guess is that you have a test.xml file on your machine that you saved at some point when the ValueList was not assigned to the column and so when you run the sample, it's loading that layout and removing the ValueList.
sorry, I forgot one step:
Please click the "Save Layout" button after loading the standard layout (in step 3).
Then the test.xml file is loaded when re-running the project, and the ValueList is not assigned to the column.
HI,
I have tested the described by you and as Michal Saltzman mentioned that may be you are loading an existing saved layout where the grid’s value list is not saved. Please check the sample I have attached:
1. Press “load data” – there must appear the lists for each cell
2. Press “save”
3. Rerun the application
4. Press “load” – the value list should be loaded
As your sample is not very clear for me, If you tell me what exactly you are trying to achieve I will be glad to help you.
Regards,
Stefaniya
there was no sample attached in your answer.
I tried to make a simpler sample than the one I posted before. What I want to do is saving and loading the layout automatically, but also give the user an option to load the default layout again, which I created at design time via the UltraGrid Designer (including the ValueLists!).
Please follow these steps to reproduce the problem:
As I described above, a workaround would be to set the ValueList property again. To test it, please uncomment line 33.
I ran your sample, and followed your steps here, and I think you are correct, there appears to be a bug here.
aluone said:Run the project and close it, then run it again. Everything should work and the layout should be loaded.
The first time you run this project, InitializeLayout is called. This saves the design-time layout of the grid to the "layout.xml_default" file. Note that at this point, the ValueList is attached to the grid column but has no items in it.
Then you check for the existance of a "layout.xml" file, which does not exist, so nothing is loaded. Then you add three items to the list.
At this point, everything is fine, as you say.
aluone said:Click the Button. The ValueListItems are gone, and the ValueList property of the column is still set. At this point, everything is OK.
Clicking the button loads the original design-time layout where the ValueList is attached to the column, but has no items in it. The grid properly reflects this, showing numbers in the column instead of names.
aluone said:Close the running project and re-run it again (please don't delete the .xml files which were created in the Debug directory). The ValueList property of the column is still set after loading the .xml file, but it doesn't show the display values, which is not right, I think.
Closing the project now triggers the Form1_FormClosing event which saves the current layout of the grid to the "layout.xml" file. So the saved layout has a ValueList with no items in it, just like the design-time layout.When you re-run the project, this layout gets loaded into the grid. At this point, it has no items in it.
But then the code adds the items back into the ValueList.In spite of this, they are not displaying on the column and the column still shows numbers instead of name.
I checked it out and it looks like the ValueList which is attached to the column is not the same instance as the one in the ValueLists collection at this point. This is clearly a bug and needs to be investigated.