We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Multiple data soruces

Using the grouping grid and CollectionBase datasources, is it possible to display a parent child type relationship as it is with DataSets? I''d be using a DataSet, except the performance is terrible at best. In any event, Class A has say 2 Col''s, A and B. Col B has 2 col''s, A and C. ( The A''s from each being the same data, Class A will hold a single record for each A, while class B will hold multiple records for each A value.

14 Replies

RK Randy Kennison July 25, 2004 01:25 AM UTC

Excuse teh terrible syntax of the below, the default size of the Message input is about 20 characters and 3 lines on this PC for some unknown reason. Makes it very very difficult to type anything at all. >Using the grouping grid and CollectionBase datasources, is it possible to display a parent child type relationship as it is with DataSets? I''d be using a DataSet, except the performance is terrible at best. In any event, Class A has say 2 Col''s, A and B. Col B has 2 col''s, A and C. ( The A''s from each being the same data, Class A will hold a single record for each A, while class B will hold multiple records for each A value.


AD Administrator Syncfusion Team July 26, 2004 10:52 AM UTC

Yes, you can define relations between primary and foreign key columns with any IList derived classes. They don''t need to be datasets. To do that, you have to manually add a GridRelationDescriptor to the groupingGrid.TableDescriptor.Relations collection. Stefan


AD Administrator Syncfusion Team July 26, 2004 11:32 AM UTC

I forgot: You need to register the different lists with Engine.SourceListSet. Let me know if you need more help. Thanks, Stefan


RK RKennison August 20, 2004 01:05 AM UTC

Actually yes.I''m having a hell of a time finding doc''s on this or samples. Basicly i have 2 classes. A , B let''s say each have members a and b. Both classes are derived from collection base. I am trying to set it so that class B''s data shows as a "sub" grid to the rows from class A. Been looking at GridRelationDescriptor. But i fail to see how to set the datasource for the secondary. I did add both with the set function already though. >I forgot: You need to register the different lists with Engine.SourceListSet. > >Let me know if you need more help. > >Thanks, >Stefan >


AD Administrator Syncfusion Team August 20, 2004 10:54 AM UTC

Attached find a sample project that demonstrates how to manually specify master-details relations between three separate tables that primary keys and foreign key columns in common. ManualRelation_9189.zip Stefan


RK RKennison August 20, 2004 08:50 PM UTC

You would think with an example..... I have the following in my code now after looking though your example. Thank you very much. But I still can''t get it to work, as a matter of fact, my root level data doesn''t show but one record when in this condition. Here is what i have before i


RK RKennison August 20, 2004 08:50 PM UTC

( limited msg length? ) GridRelationDescriptor parentToChildRelationDescriptor = new GridRelationDescriptor(); parentToChildRelationDescriptor.ChildTableName = "EQSE_Atkrs"; // same as SourceListSetEntry.Name for childTable (see below) parentToChildRelationDescriptor.RelationKind = RelationKind.RelatedMasterDetails; parentToChildRelationDescriptor.RelationKeys.Add("ID", "FightID"); this.eGrid.TableDescriptor.Relations.Add(parentToChildRelationDescriptor); this.eGrid.Engine.SourceListSet.Add( "EQSE_Fights" , e.eData.eFights ); this.eGrid.Engine.SourceListSet.Add( "EQSE_Atkrs" , e.eData.eAtkrs ); this.eGrid.DataSource = e.eData.eFights;


RK RKennison August 20, 2004 08:52 PM UTC

Class fights is of collectionbase, as is atkrs. Is there something i have to do inside the fight/atkr classes to make this work? As it is, I bomb out somwhere inside of is_expanded function ( stack trace ).


RK RKennison August 20, 2004 09:26 PM UTC

This has to be something I''m missing in the "key" part. If i Comment out the 2 lines .. RelationKey.. and the next where it "adds" the key, it works until I click on the + button to expand. I crash there. So I''m assuming there is something in my collectionbase class . that i''m missing. When the grouping engine is looking for data in the child / parent class based on the "key" fields specified.. how does it do this? I have a feeling it''s looking for something my classes that do not exist.


AD Administrator Syncfusion Team August 20, 2004 10:06 PM UTC

Could it be you just have to switch the two? parentToChildRelationDescriptor.RelationKeys.Add("ID", "FightID"); to parentToChildRelationDescriptor.RelationKeys.Add("FightID", "ID"); The first parameter needs to be a valid field/column in the parent collection. The second paramter must be from the child table. Stefan


RK RKennison August 20, 2004 11:57 PM UTC

Wow.... ID is in the parent table, fights. FightID is in the atkr table. Add''s doc''s show parent , child order. I switched them, and it no longer crashes, and actually opens a header line, no data is showing up though. I have manually verified it exists.. have to figure that one out. Is there anything special in my CollectionBase derived class that must be overridden to define a column? public long ID { get{ return lFightID; } set{ lFightID = value;} }


RK RKennison August 21, 2004 12:07 AM UTC

Darn.. Actually , it works now, but I have to comment out the relationkind setting, and my "sub" grid, shows every record. I tried the other Kind values, none worked. But not specifiying one at least no longer blows up ;)


RK RKennison August 21, 2004 12:15 AM UTC

I will pull my hair out.... it only doesn''t crash if that view is active when it''s drawn. if it''s drawn in the background it still fries...


RK RKennison August 21, 2004 02:29 AM UTC

Here is one for the books.... DevPartner Studio. This was the problem. I compleltly removed it, and all is well now. Go Figure. Anyway thanks for the help. Your sample still showed me many a few things I was missing. If only DataSet''s had some speed to them....

Loader.
Up arrow icon