grouping grid / lazy loading Businessobject

Hi,

i have nested Businessobjects which load their data on demand.

For example:
My customer - contact object holds a customer object as a property. As soon as I call the "get" method of this property to get the customer object, the customer will be loaded.

Example in code:

Contact y = new Contact()
int number = y.Customer.number // At that point the customer is loaded

And here is my issue: When i bind a lst of customer-contacts to the grouping grid, automatically all customer objects are loaded, even i dont want to bind any property of the customer to that grid.

To prevent the grouping grid to auto-generate the columns of the grid, I write a method, that adds the columns I need to the grid and binds the column to the property of the customer-contact object. I have not bound any grid column to the nested customer object, but when setting the data source property of the grid, each nested customer of the list will be loaded.

I have tested this issue with the windows default data grid. If I do not bind the nested object to a column, the customer object will not be loaded!

Is there any solution for this issue?

Thanks







4 Replies

TB Tobias Bendschneider January 29, 2008 02:50 PM UTC

Hi,

here is a sample application wich shows my problem.

Thanks for any help!




GroupingGridSample.zip


HA haneefm Syncfusion Team January 29, 2008 10:53 PM UTC

Hi Tobias,

You can handle the QueryShowField event which affects the auto population of the FiledDescriptorCollections. It is called for each fields and let you control at runtime if a specfic fields should be added to the FiledDescriptorCollections collection. You can set e.Cancel = true to avoid speific fields being added.

this.gridGroupingControl1.Engine.ShowNestedPropertiesFields = false;
this.gridGroupingControl1.Engine.QueryShowField += new Syncfusion.Grouping.QueryShowFieldEventHandler(Engine_QueryShowField);

void Engine_QueryShowField(object sender, Syncfusion.Grouping.QueryShowFieldEventArgs e)
{
if (e.Field.Name == "ObjCustomer")
{
e.Cancel = true;
}
}

Best regards,
Haneef



TB Tobias Bendschneider January 30, 2008 07:33 AM UTC

Hey Haneef,

thank u for your help!!

regards Tobias



FS Fathima Shalini P Syncfusion Team January 30, 2008 08:33 AM UTC

Hi Tobias,

Thanks for your update.

Regards,
Fathima


Loader.
Up arrow icon