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

Easy application with RadDataForm

6 Answers 174 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Leos
Top achievements
Rank 1
Leos asked on 11 Apr 2011, 09:27 AM
Hi,
I prepared small and easy application to demonstrate some of my problems.

Simple application with one table, without association and references, without paging support, with filtering and sorting (RadGridView) and CRUD operations (RadDataForm).


Live Application is here:
http://qds.aspone.cz/DiaryExample/DiaryExampleTestPage.aspx

Detailed tutorial (maybe interesting for beginners) is here:
http://qds.aspone.cz/DiaryExample/DiaryExampleAspone.pdf

And now my troubles (***):
1) When data is loaded first time, no data are displayed in DataFormXField (ID, Changed) with inserted content (TextBlock for example) . You need move to next record and go back to see values.
2) When you filter data in grid to non-existing value, you cannot add any new record. This is very critical bug.

Design of Detail templates is based on "last trial version" features - so labels cannot be aligned to right etc.
In internal build is added LabelStyle and I hope that width of labels can be changed too.

Of course if someone has some tip how to improve it please comment it here.

Leos

*** !!!!!!!!!!!!!!!!!!!!  Added later !!!!!!!!!!!!!!!!!!!!!!!!!
I modified application and added workaround described by Pavel. Both points are now working. Also PDF was modified to apply new workarounds.

6 Answers, 1 is accepted

Sort by
0
Accepted
Pavel Pavlov
Telerik team
answered on 14 Apr 2011, 03:57 PM
Hello Leos,

First of all thanks for sharing the application and the PDF instructions! You have my respect and gratitude for gathering such detailed description. Although I could ask you for a zip with the project packed, I decided to follow the instructions and rebuilding the project from scratch .  The steps were so exact and consistent  and I had the working project in a few minutes.  I am updating your Telerik points.

Now directly on the issues :

1) When data is loaded first time ....
I was able to reproduce it easily. After some debugging I found this may be due to some timing issues in setting  data context for field content. I am scheduling this for a fix.

Here is a workaround meanwhile : Instead of setting the content directly , you may set it via  the content template  such as:
<telerik:DataFormDataField Label="Changed:" >
                        <telerik:DataFormDataField.ContentTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding DiaryChanged, Mode=TwoWay}"/>
                            </DataTemplate>
                        </telerik:DataFormDataField.ContentTemplate>
                    </telerik:DataFormDataField>

I have tested this approach and it seems to fix the issue. 

2) When you filter data in grid to non-existing value, you cannot add any new record...

As discussed in another threads, currently we can not provide adding new item functionality to a filtered source ( as the new item may not pass the filter ) .  We are already brainstorming here in order to find a good approach ( might be similar to the way RadGridView handles the situation) .
Meanwhile the following workaround may be used : Turn off filtering while adding the new item ( and maybe restore it later ) .

Sincerely,
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
Leos
Top achievements
Rank 1
answered on 14 Apr 2011, 05:40 PM
Thank you very much.
I modified application (in first post) and added workarounds. Both points are now working. Also PDF was modified to apply new workarounds.
0
Deepak Shakya
Top achievements
Rank 1
answered on 08 Jul 2011, 03:12 AM
Hi Pavel,

My DataForm ItemsSource is bound to ObservableCollection. When I updated the collection, the dataform shows empty. I can navigate to next record and the first item shows.

Setting the content via content template is not helping either. Any other suggestions?
0
Dimitrina
Telerik team
answered on 11 Jul 2011, 12:47 PM
Hi Deepak Shakya,

 I have tried to reproduced such a behavior but unfortunately I was not able to.

I am attaching the sample project used to testing on my end. May you please review it and share with me what are you doing differently?

Best wishes,
Didie
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!

0
Mauricio
Top achievements
Rank 1
answered on 15 Nov 2011, 05:23 PM

 I have the same problem that presented  Deepak Shakya
 in RadControls Version v.2011.2.1107.1040


0
Mauricio
Top achievements
Rank 1
answered on 15 Nov 2011, 07:39 PM
I can resolve this in the following way:

AllItems (View)
<telerik:RadDataForm AutoGenerateFields="False"
                            AutoEdit="False"
                            AutoCommit="False"                                          
                            HorizontalAlignment="Right"
                                    CurrentItem="{Binding SelectedItemVM, Mode=TwoWay}"
                            ItemsSource="{Binding ItemVMs}"
                            CommandButtonsVisibility="Add, Delete, Edit, Navigation, Commit, Cancel"
                            ReadOnlyTemplate="{StaticResource ItemTemplate}"
                            EditTemplate="{StaticResource ItemTemplate}"
                            NewItemTemplate="{StaticResource ItemTemplate}" >
                            </telerik:RadDataForm>

AllItemesVM (Collection ItemVM)

private void LoadItemVMsByParent()
        {
            if (SelectedParent != null)
            {
                IsLoadingItemVMsByParent = true;
                _context.ItemPMs.Clear();
                EntityQuery<ItemPM> qry = _context.GetItemPMListQuery(SelectedParent.Parent.ParentID);                
                LoadOperation<ItemPM> op = _context.Load(qry);
                op.Completed += new EventHandler(opItemVMsByParent_Completed);
            }
        }

        void opItemVMsByParent_Completed(object sender, EventArgs e)
        {           
                ItemVMs.Clear();
                LoadOperation<ItemPM> op = sender as LoadOperation<ItemPM>;
                if (!op.HasError)
                {
                    ObservableCollection<ItemPM> result = new ObservableCollection<ItemPM>(op.Entities);
                    if (result == null)
                    {
                        return;
                    }

                    foreach (var item in result)
                    {
                        var vm = new ItemViewModel(item);
                        ItemVMs.Add(vm);
                    }
                    SelectedItemVM = ItemVMs[0];
                }

                IsLoadingItemVMsByParent = false;            
        }
Tags
DataForm
Asked by
Leos
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Leos
Top achievements
Rank 1
Deepak Shakya
Top achievements
Rank 1
Dimitrina
Telerik team
Mauricio
Top achievements
Rank 1
Share this question
or