Hello,
I want to export all the items from my collection but only those already loaded get exported.
How can I export the full list of items?
Do I need to use something like a RadDomainDataSource in which I tranfert the selectors from the current virtual view?
How should I do to export all my data?
Any exemple?
Thanks a lot in advance,
John.
I want to export all the items from my collection but only those already loaded get exported.
How can I export the full list of items?
Do I need to use something like a RadDomainDataSource in which I tranfert the selectors from the current virtual view?
How should I do to export all my data?
Any exemple?
Thanks a lot in advance,
John.
10 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
You need to force load of all data if you want to export all of them - download the data and load them using the Load() method of the collection.
Greetings,Vlad
the Telerik team
0
Jonx
Top achievements
Rank 2
answered on 17 Feb 2011, 04:33 PM
Hello Vlad,
Thank you for your help.
What if the collection is pretty big?
Will the virtual collection still load the items by page?
How do I force the loading of all the items?
Just call Load() ? And I guess this will take some time...
Do I have to pool somehow the view and wait until it has loaded all the items?
How do I know alll the items have been loaded?
I'm a bit lost...
Would you have a sample handy? That would help a lot...
Thanks a lot...
John.
Thank you for your help.
What if the collection is pretty big?
Will the virtual collection still load the items by page?
How do I force the loading of all the items?
Just call Load() ? And I guess this will take some time...
Do I have to pool somehow the view and wait until it has loaded all the items?
How do I know alll the items have been loaded?
I'm a bit lost...
Would you have a sample handy? That would help a lot...
Thanks a lot...
John.
0
Hello,
Vlad
the Telerik team
How the collection will load data in your case? Are you using ItemsLoading? Are you loading the data from a service?
All the best,Vlad
the Telerik team
0
Jonx
Top achievements
Rank 2
answered on 17 Feb 2011, 04:56 PM
I'm loading the view like that:
And then export like that:
Thanks a lot for the fast reply. I really need this...
John.
private
SoContext context =
new
SoContext();
public
History()
{
InitializeComponent();
//DataContext = new VirtualHistoryDatacontext();
var query = context.GetBeneficiaryOrderLinesHistoQuery().OrderBy(o => o.OdlID);
var view =
new
VirtualQueryableCollectionView() { LoadSize = 10, VirtualItemCount = 100 };
view.ItemsLoading += (s, e) =>
{
var queryToLoad = query.IncludeTotalCount(
true
).Sort(view.SortDescriptors).Where(view.FilterDescriptors).Skip(e.StartIndex).Take(e.ItemCount);
context.Load<CustomerPresentationModel>(queryToLoad).Completed += (sender, args) =>
{
var lo = (LoadOperation)sender;
if
(lo.TotalEntityCount != -1 && lo.TotalEntityCount != view.VirtualItemCount)
{
view.VirtualItemCount = lo.TotalEntityCount;
}
view.Load(e.StartIndex, lo.Entities);
};
};
DataContext = view;
}
And then export like that:
SaveFileDialog dialog =
new
SaveFileDialog();
dialog.DefaultExt = extension;
dialog.Filter = String.Format(
"{1} files (*.{0})|*.{0}|All files (*.*)|*.*"
, extension, selectedItem);
dialog.FilterIndex = 1;
if
(dialog.ShowDialog() ==
true
)
{
using
(Stream stream = dialog.OpenFile())
{
GridViewExportOptions exportOptions =
new
GridViewExportOptions();
exportOptions.Format = format;
exportOptions.ShowColumnFooters =
true
;
exportOptions.ShowColumnHeaders =
true
;
exportOptions.ShowGroupFooters =
true
;
try
{
grdHistory.Export(stream, exportOptions);
}
catch
(Exception ex)
{
ErrorWindow error =
new
ErrorWindow(
"L'exportation a échoué : "
, ex.Message);
error.Show();
}
}
}
Thanks a lot for the fast reply. I really need this...
John.
0
Hi,
Vlad
the Telerik team
You can load all data using Load<>() method of your context (SoContext) - indeed you may get communication problems if you have too much data on the server.
Best wishes,Vlad
the Telerik team
0
Jonx
Top achievements
Rank 2
answered on 17 Feb 2011, 05:08 PM
Indeed... That's why I used the virtual view...
I have two problems... Load lot's of data and load only those corresponding to the current view selectors (sorting and filters). Can I use those selector as-is to load my context collection?
I have two problems... Load lot's of data and load only those corresponding to the current view selectors (sorting and filters). Can I use those selector as-is to load my context collection?
0
Hi,
Vlad
the Telerik team
Maybe it will be better in this case to export data on the server and download the result using Telerik Reporting.
Regards,Vlad
the Telerik team
0
Jonx
Top achievements
Rank 2
answered on 17 Feb 2011, 05:16 PM
Ha yeah, I didn't think of that. Why not. Can I let my user sort, filter and group in the report?
I mean let him choose dynamicaly on which column to sort etc?
I mean let him choose dynamicaly on which column to sort etc?
0
Hi John,
It depends on your data and its presentation. If you're using the Table/Crosstab item, groups, sorting and filters are a bit more complicated to execute from end user point of view and we do not recommend doing this. The Report Designer does a great deal of work to simplify common tasks, but the underlying code is far from trivial especially when it comes to Crosstab report item, which is not a mere grid of cells and has a very complex internal structure.
Greetings,
Steve
the Telerik team
It depends on your data and its presentation. If you're using the Table/Crosstab item, groups, sorting and filters are a bit more complicated to execute from end user point of view and we do not recommend doing this. The Report Designer does a great deal of work to simplify common tasks, but the underlying code is far from trivial especially when it comes to Crosstab report item, which is not a mere grid of cells and has a very complex internal structure.
Greetings,
Steve
the Telerik team
0
Jonx
Top achievements
Rank 2
answered on 22 Feb 2011, 05:55 PM
Hello Steve,
Thank you for the link and the explanation.
I think I'll try to go that way and we'll see where it goes...
Thanks again,
John.
Thank you for the link and the explanation.
I think I'll try to go that way and we'll see where it goes...
Thanks again,
John.