Easy application with RadDataForm

7 posts, 1 answers
  1. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 11 Apr 2011 Link to this post

    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.
  2. Answer
    Pavel Pavlov
    Admin
    Pavel Pavlov avatar
    2039 posts

    Posted 14 Apr 2011 Link to this post

    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
  3. DevCraft banner
  4. Leos
    Leos avatar
    57 posts
    Member since:
    Jul 2010

    Posted 14 Apr 2011 Link to this post

    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.
  5. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 07 Jul 2011 Link to this post

    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?
  6. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 11 Jul 2011 Link to this post

    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!

  7. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Aug 2012

    Posted 15 Nov 2011 Link to this post

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


  8. Mauricio
    Mauricio avatar
    2 posts
    Member since:
    Aug 2012

    Posted 15 Nov 2011 Link to this post

    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;            
            }
Back to Top
DevCraft banner