Hi,
I'm trying out the new Data Virtualization feature explained in the following blog post:
http://blogs.telerik.com/vladimirenchev/posts/10-12-09/server_sorting_and_filtering_with_wcf_ria_services_and_telerik_data_virtualization_for_silverlight.aspx
But I'm experiencing several issues:
1. If I try to filter the collection and specify a value that I know doesn't exist in the collection. The grid of course becomes empty, but then if I try to alter or clear the filter nothing happens, the grid stays empty.
2. If I goto edit mode on a row by double clickin a cell and then hold down the down arrow to start "paging" I evetually get the following exception:
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Reflection.TargetException: Object does not match target type.
at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Telerik.SilverlightExtensions.ReflectPropertyDescriptor.GetValue(Object component)
3. Using pageup/pagedown to scroll the collection will eventually make the grid lose focus.
Tomas
19 Answers, 1 is accepted
You are right about the filtering in this demo! I'll fix it in our local demos immediately and the fix will be part of our next demos upload. In the meantime here is what to do to fix the code at your end:
...
var view = new VirtualQueryableCollectionView() { LoadSize = 10, VirtualItemCount = 100 };
view.FilterDescriptors.CollectionChanged += (s, e) =>
{
if (view.FilterDescriptors.Count == 0)
{
view.VirtualItemCount = 100;
}
};
view.ItemsLoading += (s, e) =>
{
...
The second issue was fixed immediately in RadGridView and the fix will be part of our next internal build.
You are right about the lost focus issue as well. Unfortunately this is known grid specific issue not related to the virtual collection and we do not have any stable fix so far. Of course we will continue to research the problem and hopefully we will have fix for our Q1 2011 (middle of March).
Thank you very much for your feedback - I've added 3000 Telerik points to your account .
Greetings,
Vlad
the Telerik team
Thank you. By the way do you have any plans of making a generic VirtualQueryableCollectionView?
Tomas
We do not have such plans - can you clarify why you need this?
Kind regards,Vlad
the Telerik team
Hi Vlad,
One issue we're seeing here is that if you have a GridView with AutoGenerateColumns set to True the column names will not be shown before the grid is actually bound to any data. This isn't such a big deal if you load the grid on inital load of the page (you still get an ugly flash as the columns appear though). But if the grid is populated at a later time from a designing perspective it doesn't look good to have a completely blank grid and then suddenly when it's populated with data the columns appear.
Another small issue if AutoGenerateColumns is set to False and you specify the columns in xaml you will get binding errors in Visual Studio output window on initial load as it cannot find the bindings at first.
If there's anyway around theese issues I would be more okay with a non generic version than what I currently am.
Tomas
You can set Enumerable.Empty<T>() for the initial value/data context to avoid the first problem. We've fixed the second problem immediately and the fix will be part of our next internal build (Monday). I've added 2000 Telerik points to your account. You can use also the fixed version with predefined columns (not auto-generated) to avoid the first problem.
All the best,Vlad
the Telerik team
Thank you for your great support. Could you please explain how to use Enumerable.Empty<T>() in a binding scenario in more detail.
All approaches I've tried so far will brake the "real" data loading at some point.
Tomas
It seems that you are right! Currently there is no easy way to achieve this with auto-generated columns (at least without some ugly code) and we will do our best to improve this. The only option I can suggest you for now is to use the latest build with manually declared columns (in XAML or programmatically created).
Best wishes,Vlad
the Telerik team
I'm using the build number 2011.1.315.1040 and I have the same issue if I try to scroll vertically in RadGridView more than define loadsize (50 rows in my code). It seems that include fails after the first load... Filter doesn't work to (same error)
For your information, the same code (without ".Sort(maVue.SortDescriptors).Where(maVue.FilterDescriptors)")
works with build number 2010.3.1314 and doesn't work to with build number 2011.1.315.1040.
BR
Christophe
ERROR :
Message: Unhandled Error in Silverlight Application
Code: 4004
Category: ManagedRuntimeError
Message: System.Reflection.TargetException: Object does not match target type.
Output (In French sorry)
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.LB_MOD' DataItem='{}' (HashCode=0); l'élément cible est 'Telerik.Windows.Controls.GridView.GridViewCell' (Name=''); la propriété cible est 'Value' (type 'System.Object')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.LB_MOD' DataItem='{}' (HashCode=0); l'élément cible est 'System.Windows.Controls.TextBlock' (Name=''); la propriété cible est 'Text' (type 'System.String')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_COLORIS' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_COLORIS.LB_COUL' DataItem='{}' (HashCode=0); l'élément cible est 'Telerik.Windows.Controls.GridView.GridViewCell' (Name=''); la propriété cible est 'Value' (type 'System.Object')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_COLORIS' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_COLORIS.LB_COUL' DataItem='{}' (HashCode=0); l'élément cible est 'System.Windows.Controls.TextBlock' (Name=''); la propriété cible est 'Text' (type 'System.String')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.LB_FAM' DataItem='{}' (HashCode=0); l'élément cible est 'Telerik.Windows.Controls.GridView.GridViewCell' (Name=''); la propriété cible est 'Value' (type 'System.Object')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.LB_FAM' DataItem='{}' (HashCode=0); l'élément cible est 'System.Windows.Controls.TextBlock' (Name=''); la propriété cible est 'Text' (type 'System.String')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.LB_MFAM' DataItem='{}' (HashCode=0); l'élément cible est 'Telerik.Windows.Controls.GridView.GridViewCell' (Name=''); la propriété cible est 'Value' (type 'System.Object')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.LB_MFAM' DataItem='{}' (HashCode=0); l'élément cible est 'System.Windows.Controls.TextBlock' (Name=''); la propriété cible est 'Text' (type 'System.String')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.ADA_I_RAYON.LB_RAY' DataItem='{}' (HashCode=0); l'élément cible est 'Telerik.Windows.Controls.GridView.GridViewCell' (Name=''); la propriété cible est 'Value' (type 'System.Object')..
Erreur System.Windows.Data : erreur de chemin d'accès BindingExpression : propriété 'ADA_I_MODELE' introuvable sur '{}' 'DynamicClass1' (HashCode=0). BindingExpression : Path='ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.ADA_I_RAYON.LB_RAY' DataItem='{}' (HashCode=0); l'élément cible est 'System.Windows.Controls.TextBlock' (Name=''); la propriété cible est 'Text' (type 'System.String')..
Query In Domain Service
public
IQueryable<ADA_I_REFERENCE> GetREFERENCES(Int32 aCdDep, Int32? aCdRef, Int32? aCdCoul, Int32? aCdMod, Int32? aCdSciale, Int32? aCdFam)
{
return
(from oRef
in
ADAContexte.ContexteDonnees.ADA_I_REFERENCE.Include(
"ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.ADA_I_RAYON"
).Include(
"ADA_I_COLORIS"
)
where (oRef.ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.ADA_I_RAYON.CD_DEP == aCdDep)
&& (oRef.CD_REF == aCdRef || aCdRef.HasValue ==
false
)
&& (oRef.CD_COUL == aCdCoul || aCdCoul.HasValue ==
false
)
&& (oRef.CD_MOD == aCdMod || aCdMod.HasValue ==
false
)
&& (oRef.CD_SCIALE == aCdSciale || aCdSciale.HasValue ==
false
)
&& (oRef.ADA_I_MODELE.CD_FAM== aCdFam || aCdFam.HasValue ==
false
)
select oRef );
}
ViewModel C# :
var query = _Context.GetREFERENCESQuery((Int32)_SelectedDepartement.CD_DEP, _CdRef, _CdCoul, _CdMod, _CdSciale, _CdFam).OrderBy(r => r.ADA_I_MODELE.LB_MOD).ThenBy(r => r.CD_REF);
var maVue =
new
VirtualQueryableCollectionView() { LoadSize = 50, VirtualItemCount = 1000 };
maVue.ItemsLoading += (s, e) =>
{
var queryToLoad = query.IncludeTotalCount(
true
).Sort(maVue.SortDescriptors).Where(maVue.FilterDescriptors).Skip(e.StartIndex).Take(e.ItemCount);
_Context.Load<ADA_I_REFERENCE>(queryToLoad).Completed += (sender, args) =>
{
var lo = (LoadOperation)sender;
if
(lo.TotalEntityCount != -1 && lo.TotalEntityCount != maVue.VirtualItemCount)
{
maVue.VirtualItemCount = lo.TotalEntityCount;
}
maVue.Load(e.StartIndex, lo.Entities);
};
};
References = maVue;
View XAML :
<
telerik:RadGridView
AutoGenerateColumns
=
"False"
Name
=
"dataGrid1"
ItemsSource
=
"{Binding References}"
Grid.RowSpan
=
"2"
IsReadOnly
=
"True"
EnableColumnVirtualization
=
"True"
EnableRowVirtualization
=
"True"
SelectedItem
=
"{Binding SelectedReference, Mode=TwoWay}"
IsFilteringAllowed
=
"True"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
UniqueName
=
"CD_REF"
DataMemberBinding
=
"{Binding CD_REF}"
Header
=
"Références"
IsGroupable
=
"False"
IsFilterable
=
"False"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"LB_MOD"
DataMemberBinding
=
"{Binding ADA_I_MODELE.LB_MOD}"
Header
=
"Modèles"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"LB_COUL"
DataMemberBinding
=
"{Binding ADA_I_COLORIS.LB_COUL}"
Header
=
"Coloris"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"LB_FAM"
DataMemberBinding
=
"{Binding ADA_I_MODELE.ADA_I_FAMILLE.LB_FAM}"
Header
=
"Familles"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"LB_MFAM"
DataMemberBinding
=
"{Binding ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.LB_MFAM}"
Header
=
"Méta-Familles"
/>
<
telerik:GridViewDataColumn
UniqueName
=
"LB_RAY"
DataMemberBinding
=
"{Binding ADA_I_MODELE.ADA_I_FAMILLE.ADA_I_METAFAMILLE.ADA_I_RAYON.LB_RAY}"
Header
=
"Rayons"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
Thank you very much for this report - I've added 2000 Telerik points to your account. We've found what is causing the error (nested properties + virtual collection + grid validation) and the issue was fixed immediately. The fix will be part of our next internal build - Monday.
Kind regards,Vlad
the Telerik team
Build number 2011.1.322.1040 is working fine.
Thank you very much for your reactivity.
BR
Christophe
I just download last build (2011.2.718.1040) and migrate my app.
With the same code (see my post before). The filter functionnality don't work and the grouping functionality also doesn't work.
It's a big issue for us...
Can you provide more info about the problem? Can you send us an example application where we can check this?
Regards,Vlad
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!
Can you check if you are applying filter descriptors similar our demos?
Greetings,Vlad
the Telerik team
View.FilterDescriptors.CollectionChanged += (s, e) =>
{
if (View.FilterDescriptors.Count == 0)
{
View.VirtualItemCount = 100;
}
};
I am not sure this is helping. I only have two records for testing purpose in the virtualqueryablecollectionview. Initial load is correct. Next I added one filter descriptor nothing happened. Last I cleared filter then grid displayed 100 empty rows.
You can check ItemsLoading event handler code in our demos for more info.
Regards,Vlad
the Telerik team
Is this the code in Itemloading load in the demo - not sure how this will help filter? I wanted to know if client side filter can be done with virtualview and radgridview. If not we can try to find other solutions. Thanks for the help.
context.Load<Order_Detail>(query.Skip(e.StartIndex).Take(e.ItemCount)).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);
};
I am using the latest version and still i am getting the same exact issue as discussed above by Tomas.
"Another small issue if AutoGenerateColumns is set to False and you specify the columns in xaml you will get binding errors in Visual Studio output window on initial load as it cannot find the bindings at first."
Can you please let me know a fix for this.
Are you using the generic version of the VirtualQueryableCollectionView?
Greetings,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.