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

Update TKDataFormDecimalEditor from another editor on commit

7 Answers 66 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Sal
Top achievements
Rank 1
Sal asked on 14 Feb 2016, 04:11 AM

I have a DataForm that uses a couple TKDataFormDecimalEditors, and I wanted to know if there's a way where I can update the other DecimalEditors values when another field is committed. In another scenario I was able to update the value of another DatePickerEditor by updating the valueCandidate of said editor, but I tried that here and it didn't work. 

Here's what I tried

 

override func dataForm(dataForm: TKDataForm, didCommitProperty property: TKEntityProperty) {
        //check which editor committed a value
        if property.name == "editor1" {
            //get the new value from the first editor
            let newValue = property.originalValue
             
 
        let editor2 = self.dataSource["editor2"]
        let editor3 = self.dataSource["editor3"]
        let editor4 = self.dataSource["editor4"]
        //right now just set some set some arbitrary numbers for testing
        editor2.valueCandidate = newValue * 25
        editor3.valueCandidate = newValue + 55
        editor4.valueCandidate = newValue / 6
        }
 
        self.dataForm.update()
    }

7 Answers, 1 is accepted

Sort by
0
Adrian
Telerik team
answered on 17 Feb 2016, 08:53 AM
Hello, Sal,

Thank you for contacting us.

This issue is logged in our feedback portal and it will be addressed in a future version. Currently a possible workaround is to call data form's reloadData method instead of update.

I hope this helps. If you need further assistance do not hesitate to contact us.

Regards,
Adrian
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Sal
Top achievements
Rank 1
answered on 17 Feb 2016, 03:20 PM
Thanks for the reply Adrian, do you happen to know if it would be at all possible that this will fix will make it into this months patch release or should I just wait for March's release to look for it? I can't really use the reloadData work around because whenever reloadData is called the keyboard is dismissed so the user can only type one number at a time.
0
Adrian
Telerik team
answered on 19 Feb 2016, 03:12 PM
Hello, Sal,

Our next release is scheduled for the beginning of March and the discussed functionality will be available.

Regards,
Adrian
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Sal
Top achievements
Rank 1
answered on 11 Mar 2016, 05:02 PM

Hello Adrian, 

I downloaded the updated version of the controls and now the update method is working, but on a side issue it looks when setting the value in the valueCandidate then the didCommit is called as well, which in my scenario is creating a endless loop until the app crashes since the 3 editors keep calling didCommit when trying to update the values of each other. 

0
Adrian
Telerik team
answered on 11 Mar 2016, 05:21 PM
Hello, Sal,

Could you please send me a sample project where this issue can be reproduced so I can investigate it further? Thank you in advance for your cooperation. I am looking forward to your reply.

Regards,
Adrian
Telerik
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 Feedback Portal and vote to affect the priority of the items
0
Sal
Top achievements
Rank 1
answered on 11 Mar 2016, 06:58 PM
Actually Adrian I found the issue while working on the sample project to send you. It was my mistake, the method that I was using to update the editors was being called multiple times because of how I set it up, but now it's fixed and the DataForm is working correctly. Thanks. 
0
Adrian
Telerik team
answered on 14 Mar 2016, 07:49 AM
Hello, Sal,

Thank you for this feedback. I am glad that the issue is solved. In case you need further assistance, feel free to contact us again.

Regards,
Adrian
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
DataForm
Asked by
Sal
Top achievements
Rank 1
Answers by
Adrian
Telerik team
Sal
Top achievements
Rank 1
Share this question
or