ProgressNS / nativescript-ui-feedback

This repository is used for customer feedback regarding Telerik UI for NativeScript. The issues system here is used by customers who want to submit their feature requests or vote for existing ones.
Other
115 stars 21 forks source link

RadDataForm propertyConverter not updating view. #349

Closed bori87 closed 7 years ago

bori87 commented 7 years ago

Converter is working but the view is not updating.

ngOnInit(){
  this.currencyConverter = new CurrencyConverter();
  ...
}

export class CurrencyConverter implements PropertyConverter {
    constructor() { }

    convertFrom(input: number) {
        console.log(input * 4);
        return input * 4;
    }

    convertTo(output: number) {
        console.log(input * 2);
        return output * 2;
    }
}
<TKEntityProperty tkPropertyGroupProperties name="price" displayName="Wynagrodzenie" index="1" columnIndex="1" [converter]="currencyConverter">
  <TKPropertyEditor tkEntityPropertyEditor type="Decimal"></TKPropertyEditor>
</TKEntityProperty>
NickIliev commented 7 years ago

@bori87 the converter is not accepting any input value in its constructor so it does not "know' what to convert.

constructor(input: number) { }

And then pass the value you want to convert when initializing your new Converter

this.currencyConverter = new CurrencyConverter(myValue);

Real-life example can be found here - the converter is used here with this._movies object

bori87 commented 7 years ago

Is not working. I want the user to input price like '1,21' then convert to 1.21. Also the keyboard should be numeric.

bori87 commented 7 years ago

The price is not formatted in the given example. ns

bhcuong2008 commented 4 years ago

Current dataform Decimal editor does not allow to input negative number. So could I use converter to convert between source object number and text input on UI? I try but not know how to do that. When specifying tkEntityPropertyEditor of type Text with source object number field, then it shows error,

ERROR Error: java.lang.Error: DataFormTextEditor does not support properties of type Integer. Please specify a value converter for your property.

I already created converter for that field property. But error is the same as above.