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

QDSCV not loaded after new item is added

5 Answers 39 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Ubuntu
Top achievements
Rank 1
Ubuntu asked on 09 Apr 2011, 06:08 PM
Dear All,

I hope this is the correct place for my post.
I have started evaluating OA days ago, I then start using the QDSCV collection to fetch some items from database.

I have a QDSCV to load data from one of my database tables, I can edit any of them and submit using OA no problem but when I try to add new items, although the item is committed successfully at OA, the QDSCV doesn't load the entities at all.

I have a refresh button, when I hit it after the new item is added it shows up the entities. what is the difference here ...

I am using a BackGroundWorker to do the job while the page is loading, and I am just calling the same function after I save the new item, it is also called from the refresh button.

Does it make any sense.
Best

5 Answers, 1 is accepted

Sort by
0
Rossen Hristov
Telerik team
answered on 11 Apr 2011, 01:03 PM
Hello Ubuntu,

When you make changes, you have to call the QDSCV.SubmitChanges method so that it submits the pending changes to the server. The QDSCV will submit the changes and then automatically Load from the server so that the view it shows is up-to-date.

Alternatively, you can call DomainContext.SubmitChanges and then do a manual call to QDSCV.Load, because if the QDSCV is not the one that submits the changes, it will have no clue that something has happened and that is why you have to manually call its Load method.

I hope this helps.

Best wishes,
Ross
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
Ubuntu
Top achievements
Rank 1
answered on 11 Apr 2011, 01:44 PM
Hello Ros,

I guess this is what I asked about.

I am currently using OA to submit-changes Not the QDSCV and the problem arise when the QDSCV is not refreshed although I call the reload method after submitting the data. But If I press the button it works ... what is the difference ...

Best

0
Rossen Hristov
Telerik team
answered on 11 Apr 2011, 01:54 PM
Hi Ubuntu,

I am not sure. I can't tell without being able to debug your project.

What exactly does this button do? What happens if you use a "normal" WCF RIA domain service instead of OA? In other words, if you temporarily remove OA and target your sample project against the default domain services with EF -- is the behavior the same or different?

Alternatively, what happens if you use a DomainCollectionView instead of the QDSCV. They serve the same basic purpose. Is the behavior the same or different?

By the way, why aren't you submitting the changes through the QDSCV? I guess that if you don't submit them through it, something might go wrong, but I am not sure.

Best wishes,
Ross
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
Ubuntu
Top achievements
Rank 1
answered on 11 Apr 2011, 11:08 PM
Hello Ross,

I was using EF. and everything was okay, because I was submitting the changes using the QDSCV, But I want to use the OA instead and I am handing the exceptions that way, also I want to centralize the CRUD operation using OA, right approach .. I guess.

I will try the DCV.. today.
I guess it is something with the Async. calling, I mean I call the two functions sequently, so the second one (which is the load) is not taking the time to do it's job.I believe I need to wait until the commit finish then call the load, but I can't see how can I do that, If you can help me will be great.

The button is calling the refresh method that is using the Background worker. I just call that method after submitting the changes.
Here is the refresh method:
private void Refresh(object Ignored)
{
    Comments = "";
    IsBusy = true;
    bw.RunWorkerAsync(Items);
}
and here is where I delete the record & then call the refresh:
public void Delete(object ignored) 
    DataService.DeleteItem(CurrentItem); 
    Items.Load(); 
   // Refresh("");
}
The Items is the QDSCV and CurrentItem is the Entity object.
I hope you can help me in this matter.

Best


0
Ubuntu
Top achievements
Rank 1
answered on 13 Apr 2011, 11:36 PM
Hello Ross,

Don't bother I already figure it out !!

Regards
Tags
DomainDataSource
Asked by
Ubuntu
Top achievements
Rank 1
Answers by
Rossen Hristov
Telerik team
Ubuntu
Top achievements
Rank 1
Share this question
or