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

After AddNewItem the Record is not shown in Form. ?

5 Answers 16 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 29 Jul 2018, 01:53 PM

Hi Telerik ,

i have a problem but can´t see a solution yet.I do not know if its a bug somewhere.I hope you have a hint what could be the problem. 

MVVM + WPF

1) I have a Grid + RadDataForm

<Grid>
        <telerik:RadDataForm x:Name="LookupListFormCtrl"
                         Header="{Binding DisplayName,FallbackValue='Lookup'}" 
                         AutoGenerateFields="False"
                         CommandButtonsVisibility="All"
                         ItemsSource="{Binding Nodes,Mode=TwoWay}"
                         CurrentItem="{Binding SelectedUiDataItem,Mode=TwoWay}"
                         BorderBrush="Green" BorderThickness="6"
                         ReadOnlyTemplate="{StaticResource LookupListFormDataTemplate}"
                         EditTemplate="{StaticResource LookupListFormDataTemplate}"
                         />
</Grid>

 

with the Resource Template as 

    <DataTemplate x:Key="LookupListGridDataTemplate" DataType="{x:Type local:LookupListGrid}">
        <UniformGrid Columns="2">
			<telerik:DataFormDataField  Label="LOOKUP"
										DataMemberBinding="{Binding lookup_lkp, Mode=TwoWay}"/>
			<telerik:DataFormComboBoxField Label="GROUP LOOKUP" 
											DataMemberBinding="{Binding  group_lookup_lkp, Mode=TwoWay}"
											DisplayMemberPath="display_nam"
											ItemsSource="{Binding Nodes.GroupLookups}"  
											SelectedValuePath="lookup_lkp" 
											IsComboboxEditable="False" />
			<telerik:DataFormComboBoxField Label="PAR LKP LOOKUP" 
											DataMemberBinding="{Binding  par_lkp_lookup_lkp, Mode=TwoWay}"
											DisplayMemberPath="display_nam"
											ItemsSource="{Binding Nodes.ParLkpLookups}"  
											SelectedValuePath="lookup_lkp" 
											IsComboboxEditable="True" />
			<telerik:DataFormComboBoxField Label="PAR LKP GROUP LOOKUP" 
											DataMemberBinding="{Binding  par_lkp_group_lookup_lkp, Mode=TwoWay}"
											DisplayMemberPath="display_nam"
											ItemsSource="{Binding Nodes.ParLkpGroupLookups}"  
											SelectedValuePath="lookup_lkp" 
											IsComboboxEditable="True" />
			<telerik:DataFormDataField  Label="DISPLAY"
										DataMemberBinding="{Binding display_nam, Mode=TwoWay}"/>
			<telerik:DataFormDataField  Label="DISPLAY SHORT"
										DataMemberBinding="{Binding display_short_txt, Mode=TwoWay}"/>
				
			<telerik:DataFormCheckBoxField  Label="VALID" DataMemberBinding="{Binding IsValidYn, Mode=TwoWay}" />
                    
        </UniformGrid>
    </DataTemplate>

I query the Data from DB and it´s shown as well if i press the Update Button the Form changes to writable and all the Columns are viewable and changeable. 

So Fine. 

My "Nodes" Class ( = Item Source ) is derived from ObservableItemCollection<T> and enhanced with IEditableCollectionViewIEditableCollectionViewAddNewItem

In the derived Class the methods of IEditableCollectionView  are written and linked to a class which is as well derived from 

 DataFormCommandProvider. ( because i encapsulate all the method calls there ) 

Additionaly this derived class is also added to the DataForm in the View Code behind.

parentcollection.CommandProvider.DataForm = LookupListFormCtrl;

 

At the End in the MyCommandProvider class a new Item is created and added to the Collection. ( this i see in the Debug Mode) and also the Current Item 

is set to the new empty created Item. 

Until here it looks fine but the Form doesn´t show me the "empty" Record i created , I checked also if the Current Item ( = SelectedUiDataItem ) 

is this newly created ones and it is. And also all the Can* Methods returning true. 

First i thought there is somewhere a bug on my side but know i am not sure because 

i changed AutoGenerateFields="True" and in this moment the Form show all the columns i expected. 

In behind the same methods are called and new Item to collection is created. 

In the derived Class of DataFormCommandProvider i called additionaly the .AddNew() before i created and added a new Item but anyhow it´s has no effect. 

I think i have overseen some parameter to the xaml or forgot to set something so i hope on any hint from yours. 

Thanks br Thomas Cinatl 

 

 

 

 

 

 

 

 

 

  

 

 

 

 

 

 

 

5 Answers, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 01 Aug 2018, 01:42 PM
Hello Thomas,

Thank you for the detailed explanation of your setup.

I tested the behavior of the control with a setup similar to the described one, but was not able to replicate the reported behavior. Attached to my reply you can find the sample application I used for testing. As you can see, customized data fields are used and a new item is added through the custom KeyboardCommandProvider implementation. Can you please check this out? Does the project setup differentiate from the approach you are using on your end? Also, would it be possible for you to modify the sample so that the malfunction is reproduced and send it as an attachment through a new support ticket? The process of submitting a support ticket is discussed in details in this blog post.

Thank you in advance for your cooperation.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Thomas
Top achievements
Rank 1
answered on 02 Aug 2018, 07:06 AM

Hallo Stefan , first thank you for help i will check the sample and also try to use the new support tickets in future.

br thomas

 

0
Accepted
Stefan
Telerik team
answered on 02 Aug 2018, 12:21 PM
Hi Thomas,

Please, take you time to review the sample application. Again, thank you for your cooperation.

All the best,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Thomas
Top achievements
Rank 1
answered on 06 Aug 2018, 11:34 AM

Hi thanks for Help with the Sample i compared and 

the missing thing was the only

NewItemTemplate="{StaticResource LookupListFormDataTemplate}"

br thomas 

 

 

0
Stefan
Telerik team
answered on 07 Aug 2018, 03:55 PM
Hi Thomas,

Thank you for the update.

I am pleased to hear that the provided sample helped you find the cause for the behavior you were experiencing. It seems that I have overlooked the missing NewItemTemplate from your initial post so please, excuse me for this. You can take a look at the Defining Custom DataFields topic for more information on this matter.

Feel free to contact us again in case you need any other assistance with our components.

Regards,
Stefan
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DataForm
Asked by
Thomas
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Thomas
Top achievements
Rank 1
Share this question
or