Hi, i tried to set de Grid Display Layout Override for the Expansion Indicator to Check on Display to prevent the Grid from showing "+" even if there is no child band for some rows.
but there was no difference.
i use a IENumerable Object as Datasource for the Grid.
i tried also with Windows Forms BindingSource, no difference
private void ultraGrid1_InitializeLayout(object sender, InitializeLayoutEventArgs e) { e.Layout.Override.ExpansionIndicator = ShowExpansionIndicator.CheckOnDisplay; } private void SetDataSource() { this.ultraGrid1.DataSource=this.Object; //this.ultraGrid1.DataSource= this.BindingSource also tried via bindingSource }
also tried Override in Bands and searched a lot, nobody seems to have this kind of problem.
do i missed something?
thanks
Tom
Hello Tom,
Thank you for contacting Infragistics Developer Support!
It is possible that your datasource is noting that there are children where you have none. So when the grid is looking at your datasource it is seeing children where there are none.
Do you have a sample you can attach?What version are you using?
the IENumerable Object i provide as Datasource is filled with data and contains also List properties which are shown as child bands. everything is looking and working as it should, like expanding single rows or all of them.
as soon as i click on the "+" to expand a row and there is no child the "+" is disappearing. but of course if i reload the data and refresh the grid all of the "+" icons are shown again.
i tried to set null or empty List for the "child" property in the Object, makes no difference.
are there some requirements for the List properties in the Object i use as Data Source? for example do they have to be IENumerable or something like this?
i simply tried to set as Datasource a List<Object> where Object contains some string properties and also List<Object> for Child Band. it doesnt matter if this Sub List<Object> is null or empty List or filled List... there is always the "+" icon.
it seems like the grid is looking at the definition of the Object i use as Datasource and is checking ther is a property which is a List<> and is not checking if the list is empty or null as long as the user is not trying to expand by click on the icon.
its weird, because even when i set the Expansion Indicator to Never the Icon is shown. i tried in the Design and Code
Version of the Grid is 18.1
we will upgrade anyway to actual version the next weeks...
There isn't enough information here for me to tell you exactly why this isn't working. So if you could post a sample project demonstrating the issue, we could check it out. But here are some general guidelines...IEnumerable is not a good type to use as a DataSource for the grid. List<T> is better, but still not great. And if you are going to use List<T>, the I would strongly recommend that your T is a specific type and not 'object'. The best data source to use is BindingList<T> (and once again, I would advise against using 'object' and recommend using a more specific type. To get child rows displayed with a BindingList<T>, your type T should expose a property (not a member) tha also returns a BindingList<T> (T in this case need not be the same T as in the root collection, of course). And this property should NEVER return null. It should always return an instance of a BindingList<T>, even if that list contains 0 items.
If none of that helps, then my next best guess is that something in your code is setting the ExpansionIndicator to something else after you set it to CheckOnDisplay. Perhaps you are setting that property and then loading a Layout into your grid which is overwriting it. Or something else is your code is re-setting it after you set it. It might be a good idea for you to put a button on your form and read out the value of that property at run-time, just to make sure it is, in fact, set to what you think it is.
you are right, i do load the last saved layout for each user and this overwrites the one i set in initialize...
i didn't knew this is also stored in the saved layouts. i saw there are some settings to choose the types of settings stored in the saved layout, i will also have a look on this.
thank you very much for the solution and also for the other hints.
b.r.
Ah, glad you found it.
That's an easy trap to fall into. Pretty much everything on the DisplayLayout or any sub-object is saved into the layout. The options for saving and loading give you some broad categories to include/exclude, but there is no way to single out a specific property.
So I recommend that you simply set the ExpansionIndicator property in code immediately after you load the layout. That way it will override whatever is in the saved layout file.