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

Having two issues with synching w/Grid and Insert mode

5 Answers 121 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Ben Hayat
Top achievements
Rank 2
Ben Hayat asked on 29 Mar 2011, 05:19 AM
Hi Team;

I'm a couple of problems and hoping you can direct me to the right direction. I'll explain the two direction I've taken and either one raises a different problem:

My Goal: My goal is actually very simple and is similar to the example ICollectionView Synchronization, but here I'm using RIA Services and I'm using QDVCS collection.
I have a grid on the left side of the page and on the right side of the page I have a RADDataForm. I'd like the gridView to stay as a ReadOnly grid to show a series of records from database and I'd like to use the DataForm as a means of showing details and perform CRUD. And I need these two to synch with each other. Sounds simple but something is not working right, because I can not either get it to synch or go into Insert/Add mode.

In code-behind, before the constructor, I declare my Domain Context.
private PDF_BO_DomainContext ctx = new PDF_BO_DomainContext();
Then I declare a property of QDSCV:
public QueryableDomainServiceCollectionView<PDF_BO_SubAcct> Collection
{ get; set;}
After the page is loaded, I create my EnityQuery:
EntityQuery<PDF_BO_SubAcct> SubAcctQuery = ctx.GetPDF_BO_SubAcctQuery();
Then build my collection:
this.Collection = new QueryableDomainServiceCollectionView<PDF_BO_SubAcct>(ctx, SubAcctQuery);
Collection.LoadedData += new EventHandler<Telerik.Windows.Controls.DomainServices.LoadedDataEventArgs>(Collection_LoadedData);
Then I call the Load on my collection.
Collection.Load();

In the LoadedData event, I set the DataContext of my page to the e.Entities:
this.DataContext = e.Entities;

This works fine to get a list of records.

Case 1: In this case in XAML I do the binding to GridView as following and the data shows:
<telerik:RadGridView ShowGroupPanel="False" Grid.Row="1" AutoGenerateColumns="True"
                                 RowIndicatorVisibility="Collapsed" Name="SubAcct_GridView"
                                 ItemsSource="{Binding}"/>
And I do the binding with dataform as following:
<telerik:RadDataForm Grid.Column="1" x:Name="SubAcct_DF" Grid.RowSpan="3"
                                 CommandButtonsVisibility="Add,Edit,Cancel,Commit" AutoGenerateFields="False"
                                 ItemsSource="{Binding}" Background="{x:Null}">

I see two problems:
First there is no synchorization between grid and dataform.
Secondly, the Add icon shows, but disabled and I can't get into Add mode.

Case 2: In this case, I did the binding of DataForm with "CurrentItem" instead of ItemsSource. and it was binded to Grid's Current Item:
<telerik:RadDataForm Grid.Column="1" x:Name="SubAcct_DF" Grid.RowSpan="3"
                                 CommandButtonsVisibility="Add,Edit,Cancel,Commit" AutoGenerateFields="True"
                                 CurrentItem="{Binding Path=CurrentItem ,ElementName=SubAcct_GridView}">
          
In this case, I get the synch to work, but I don't see the ADD icon and can't get it to go into Add mode.

Note: I've created DataTemplates for all three modes.

Thank you in advance.
..Ben

5 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 01 Apr 2011, 09:20 AM
Hi Ben Hayat,

I would strongly recommend to use the "external row details" aproach as demonstrated in our examples.
However we can check what is not right with your proposed setup .
I will be glad if you could give me a small runnable project with this setup  . I am going to check what is wrong - it can be either a bug or a wrong setup .

Greetings,
Pavel Pavlov
the Telerik team
0
Ben Hayat
Top achievements
Rank 2
answered on 01 Apr 2011, 03:20 PM
Pavel;
I would strongly recommend to use the "external row details" aproach as demonstrated in our examples.

What do you mean by "External Row Detail"?
The DataForm is not inside of the grid. It's side-by-side as of this picture.

Please make your examples to work with RIA services using the collection rather than all using DataSource. This way perhaps you can also see where it's not working. In all the examples of dataform, datasource and grid, it's just repetition of the same approach over and over using datasource and employees collection. Please switch to real life samples with RIA services and the query collection in code behind so, we get some proper guidelines. Otherwise people will not use the product if there is not helpful docs and samples. DataForm are for using real database apps rather in memory objects like Employee class.

Secondly, please show a real full CRUD app with RIA that shows grid as showing many records and dataform is user for ADDING,DELETING and UPDATING.

I keep searching Gridview, DataSource and Dataform samples to get one meaningful samples to progress and seems like they're very basic few lines of code using gridview and datasource control.

Thanks!
0
Pavel Pavlov
Telerik team
answered on 06 Apr 2011, 12:46 PM
Hi Ben Hayat,

Indeed you are right.
We are already preparing a full CRUD RIA Services example for our QSF as requested.
I will let you know as soon as it is ready.

Kind regards,
Pavel Pavlov
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
Ben Hayat
Top achievements
Rank 2
answered on 06 Apr 2011, 02:40 PM
Thank you Sir!
..Ben
0
Ben Hayat
Top achievements
Rank 2
answered on 06 Apr 2011, 03:22 PM
The essential topics that should be covered:
a) Work with a real database case and not just a made-up collection in a local class.
b) Use the internal collection of DataSource in code behind instead of just dropping in DS.
c) There seem to be confusing number of Collections that come to play between the RIA Domain Service and all the way to GridView and DataForm. Please identify what collections, developer must use in order for the GridView & dataform to share and remain in synch. It seems like from one point SL is getting easier and from another point it's becoming more convoluted.
d) Write the demo, like someone is really using it for real situation and not just trying to show off by one DataSource, DataForm and Employee Collection. This actually gives the product lack of credit that it can not do real life application.

I hope these will server as positive point to help everyone with using the product.
Thanks!
..Ben
Tags
DataForm
Asked by
Ben Hayat
Top achievements
Rank 2
Answers by
Pavel Pavlov
Telerik team
Ben Hayat
Top achievements
Rank 2
Share this question
or