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.
Let me know if you will need any further help.
Regards,
Stefaniya
you are right, your sample works.
Please have a look at my modified sample and test these steps:
What I don't understand is: Why do I have to set the ValueList property of the column again in this case, even it I have set it via the Designer? Is the InitializeLayout() method wrong for this? Maybe the property hasn't been set at this point.
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.
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.
Please try the following:
1. The previous steps
2. Close the application – the two layouts are saved already
3. Remove everything from the InitializeLayout event in Form1.cs
4. Press “Yes” on “Load saved layout?” – the last saved valuelist should be assigned to the column
Please notice that in this scenario in layout_default.xml will not be saved any valuelist information and if loaded, after that on form closing in the other layout file will not be saved data for any valuelist.
your sample uses the workaround (line 33) I mentioned before. You re-assign the ValueList to the ValueList property of the grid column every time in the InitializeLayout method.
I think this should not be necessary, if I have already set this property via the Designer.
It seems like we do not find a solution for this, so I will set the property manually in the code after loading a grid layout.
Thank you,
Best regards
I apologize, I really have forgotten to upload the sample. I have modified your sample as I moved some code to the Load event of the form (please check it):
1. Run the sample
2. Press “No” to “Load saved layout?” – there must appear the grid with the valuelist defined in the initializeLayout event of the grid – this valuelist is saved in layout_default.xml on Load of the form
3. Click on “load valuelist” – the valuelist of the column is changed. If you click on “Load default layout” at this moment the previous saved valuelist will be displayed
4. Close the application – and the second valuelist will be saved in layout.xml
5. Rerun the application
6. Press “Yes” to “Load saved layout?” – the valuelist saved in layout.xml will be assigned to the column
Let me know if you have any questions.
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.