This is a migrated thread and some comments may be shown as answers.

Data Source Business Objects

7 Answers 1114 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Marco Teodoro
Top achievements
Rank 1
Marco Teodoro asked on 11 May 2010, 11:16 AM
Hello,
I have a function that will return my dataSource to telerik report. 
But i have some doughs? 

See the above sample 
public class dataSourceObj 
    public string Name {get; set;} 
    public ComplexType ComplexDto {get; set;} 
}  
 
public class ComplexType  
    public string ComplexTypeName {get; set;} 
    public int id  {get; set;} 
    public List< subType> subTypeList {get; set;} 
 
public class subType 
    public string subTypeName {get; set;} 
    public int id  {get; set;} 
    public int ComplexTypeid  {get; set;} 
 

So if i create a datasource to my report and set some function to return the dataSourceObj class i will see the properties Name, complexType, and inside this one i will see -> ComplexTypeName and id but not subTypeList.

Why this is happening?

Best Regards
Marco Teodoro

7 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 14 May 2010, 09:24 AM
Hi Marco Teodoro,

Because it is a collection property within your business object and we do not drill down into the hierarchy. If your purpose is to bind a data item (i.e. report, table, chart) to this collection, you can use the Bindings property. This way you can bind declaratively the DataSource property of a data item to a given collection property from your business object and the data item will display all the collection items. To illustrate this approach better I have attached a small sample report to my post. If you need more information regarding this you can visit the following help topic from our online documentation which discusses property bindings via expressions more in-depth.

Regards,
Steve
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Marco Teodoro
Top achievements
Rank 1
answered on 14 May 2010, 11:41 AM
Hello Steve,

i have made some modification on the sample you have attached to accomplish my needs but unfortunately i can't make it work.

this is my dataSource:

 [DataObject] 
    public class ReportData 
    { 
 
        public string Name { get; set; } 
        public List<SampleModel> dataSourceList { get; set; } 
        [DataObjectMethod(DataObjectMethodType.Select)] 
        public ReportData GetModel() 
        { 
            this.Name="dataSourceName"
            this.dataSourceList = new List<SampleModel> 
            { 
                new SampleModel 
                { 
                    Name = "Sample Model 1"
                    Value=1
                    sampleItem = new SampleItem 
                    { 
                        Name = "Sample Item 1"
                        Items = new List<SampleSubItem> 
                        { 
                            new SampleSubItem { Name = "SubItem 1"Value = 1 }, 
                            new SampleSubItem { Name = "SubItem 2"Value = 2 }, 
                            new SampleSubItem { Name = "SubItem 3"Value = 3 }, 
                            new SampleSubItem { Name = "SubItem 4"Value = 4 }, 
                            new SampleSubItem { Name = "SubItem 5"Value = 5 }, 
                            new SampleSubItem { Name = "SubItem 6"Value = 6 }, 
                            new SampleSubItem { Name = "SubItem 7"Value = 7 }, 
                            new SampleSubItem { Name = "SubItem 8"Value = 8 }, 
                            new SampleSubItem { Name = "SubItem 9"Value = 9 } 
                        } 
                    } 
                }, 
                new SampleModel 
                { 
                    Name = "Sample Model 2"
                    Value=2
                    sampleItem = new SampleItem 
                    { 
                        Name = "Sample Item 2"
                        Items = new List<SampleSubItem> 
                        { 
                            new SampleSubItem { Name = "SubItem 1"Value = 1 }, 
                            new SampleSubItem { Name = "SubItem 2"Value = 2 }, 
                            new SampleSubItem { Name = "SubItem 3"Value = 3 }, 
                            new SampleSubItem { Name = "SubItem 4"Value = 4 }, 
                            new SampleSubItem { Name = "SubItem 5"Value = 5 }, 
                            new SampleSubItem { Name = "SubItem 6"Value = 6 }, 
                            new SampleSubItem { Name = "SubItem 7"Value = 7 }, 
                            new SampleSubItem { Name = "SubItem 8"Value = 8 }, 
                            new SampleSubItem { Name = "SubItem 9"Value = 9 } 
                        } 
                    } 
                } 
                , 
                new SampleModel 
                { 
                    Name = "Sample Model 3"
                    Value=3
                    sampleItem = new SampleItem 
                    { 
                        Name = "Sample Item 3"
                        Items = new List<SampleSubItem> 
                        { 
                            new SampleSubItem { Name = "SubItem 1"Value = 1 }, 
                            new SampleSubItem { Name = "SubItem 2"Value = 2 }, 
                            new SampleSubItem { Name = "SubItem 3"Value = 3 }, 
                            new SampleSubItem { Name = "SubItem 4"Value = 4 }, 
                            new SampleSubItem { Name = "SubItem 5"Value = 5 }, 
                            new SampleSubItem { Name = "SubItem 6"Value = 6 }, 
                            new SampleSubItem { Name = "SubItem 7"Value = 7 }, 
                            new SampleSubItem { Name = "SubItem 8"Value = 8 }, 
                            new SampleSubItem { Name = "SubItem 9"Value = 9 } 
                        } 
                    } 
                } 
            }; 
            return this; 
        } 
    } 
 
    public class SampleModel 
    { 
        public string Name { get; set; } 
        public int Value { get; set; } 
        public SampleItem sampleItem { get; set; } 
    } 
 
    public class SampleItem 
    { 
        public string Name { get; set; } 
        public List<SampleSubItem> Items { get; set; } 
    } 
 
    public class SampleSubItem 
    { 
        public string Name { get; set; } 
        public int Value { get; set; } 
    } 

so far i was able to see and render the list of sample models using one table and binding it using the =Fields.DataSourceList

and then on table i'm using =Fields.Name and =Fields.Value.

so far so good.

my question now is: how can i bind sample item class?

can i send you my modified sample?
hope you can help me,
best regards
Marco Teodoro
0
Hrisi
Telerik team
answered on 20 May 2010, 11:37 AM
Hello Marco,

You can bind it in similar way i.e you should nest another Data Item (Table, SubReport, Chart) in the table
cell.

ReportData                                                             -> bound to report through DataSource
    Name
    dataSourceList(List<SampleModel>)           -> bound to table through Bindings expression
        Name
        Value
        sampleItem(SampleItem)
            Name
            Items(List<SampleSubItem>)                 -> bound to nestedTable through Bindings expression
                Name
                Value

You can see the pattern - collections are bound to Data Items, primitive types -  to the rest of report items (TextBox, PictureBox ...). Sample project is attached for your convenience.

Sincerely yours,
Hrisi
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
kero
Top achievements
Rank 1
answered on 28 Dec 2010, 04:35 PM
new SampleModel
                {
                    Name = "Sample Model 1",
                    Value=1,
                    sampleItem = new SampleItem
                    {
                        Name = "Sample Item 1",
                        Items = new List<SampleSubItem>
                        {
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 },
                            new SampleSubItem { Name = "SubItem 1", Value = 1 }
                        }
                    }
                },
                new SampleModel
                {
                    Name = "Sample Model 2",
                    Value=2,
                    sampleItem = new SampleItem
                    {
                        Name = "Sample Item 2",
                        Items = new List<SampleSubItem>
                        {
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 },
                            new SampleSubItem { Name = "SubItem 2", Value = 2 }
                        }
                    }
                }
                ,
                new SampleModel
                {
                    Name = "Sample Model 3",
                    Value=3,
                    sampleItem = new SampleItem
                    {
                        Name = "Sample Item 3",
                        Items = new List<SampleSubItem>
                        {
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 },
                            new SampleSubItem { Name = "SubItem 3", Value = 3 }
                        }
                    }
                }

Please, modify your sample as follow.
There are bug, in all rows will be nested list from first element
Is there any way to fix it?
0
Support ATT
Top achievements
Rank 1
answered on 25 Jul 2014, 02:50 PM

Hello Telerik

With this Solution it will show all Items (SamplyModel) on one Page. So if you have over 5000 Objects it will be very slow to scroll. How you implement the PageBreak that it create a new Page if it reaches at the end of an A4 Pages ...

Thank you for you help.

regards
David

0
Stef
Telerik team
answered on 29 Jul 2014, 12:28 PM
Hi,

For anyone concerned, below is a quote from my reply in his support ticket:

"Page breaks are only supported by report sections. The Table item is rendered continuously on a single page in Interactive preview, which may cause you issues in certain browsers when there are more than the allowed for the browser elements. For more details and solution, please check the Design Considerations for HTML Rendering article.

Other approach is to reorganize the report by data-binding the report, setting up report group, adding the Table to the group header section (or other section), set the group header page break to PageBreak.After and data-binding the Table with a Binding expression.
..."

All the best,
Stef
the Telerik team
 
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
 
0
Asmaa
Top achievements
Rank 1
answered on 28 Mar 2018, 11:34 AM
I need to create telerik report for javascript contain table but table data source dynamic how can i make it 
Tags
General Discussions
Asked by
Marco Teodoro
Top achievements
Rank 1
Answers by
Steve
Telerik team
Marco Teodoro
Top achievements
Rank 1
Hrisi
Telerik team
kero
Top achievements
Rank 1
Support ATT
Top achievements
Rank 1
Stef
Telerik team
Asmaa
Top achievements
Rank 1
Share this question
or