Hi telerik,
I am confused how to use RadGridView with VirtualQueryableCollectionView in order for data virtualization, but some issues encountered when I insert a new item, let me clarify.
I use the below code to set datacontext of a window,
but there are some specified points, the Tax table only have 7 records, those records can show in grid correctly,but if I use blow code for inserting a new item,
this new item will not display in grid expect adding this statement
But executing this statement will refresh the collection and grid, I don't want to do this. so my questions are
1. How can I show all records if called insert statement?
2. How to save a new records to database?
I did this using below statements currently:
if I can add use VirtualQueryableCollectionView's AddNew/AddNewItem/Insert add a item to VirtualQueryableCollectionView and then call someone method to save it to database directly without needing executing context.CreateObjectSet<TValue>().AddObject(newItem);
? if yes, could you provide a sample project for me? thanks very much.
I am confused how to use RadGridView with VirtualQueryableCollectionView in order for data virtualization, but some issues encountered when I insert a new item, let me clarify.
I use the below code to set datacontext of a window,
var query = _context.Taxes.OrderBy(o => o.TaxID);
//Order_Details.OrderBy(o => o.OrderID);
var view =
new
VirtualQueryableCollectionView(query) {LoadSize = 10 };
DataContext = view;
but there are some specified points, the Tax table only have 7 records, those records can show in grid correctly,but if I use blow code for inserting a new item,
private
void
Button_Click(
object
sender, RoutedEventArgs e)
{
(DataContext
as
VirtualQueryableCollectionView).AddNew(
new
Tax() { TaxCode =
"45"
,TaxPercentage2 = 0.34f });
}
this new item will not display in grid expect adding this statement
(DataContext
as
VirtualQueryableCollectionView).VirtualItemCount++;
But executing this statement will refresh the collection and grid, I don't want to do this. so my questions are
1. How can I show all records if called insert statement?
2. How to save a new records to database?
I did this using below statements currently:
(DataContext
as
VirtualQueryableCollectionView).
Insert(0, newItem);
context.CreateObjectSet<TValue>().AddObject(newItem);
context.SaveChanges();
if I can add use VirtualQueryableCollectionView's AddNew/AddNewItem/Insert add a item to VirtualQueryableCollectionView and then call someone method to save it to database directly without needing executing context.CreateObjectSet<TValue>().AddObject(newItem);
? if yes, could you provide a sample project for me? thanks very much.