Telerik Forums
Kendo UI for Angular Forum
1 answer
613 views
I have a kendo grid with one column in the percentage format. Currently I am using the built in numeric filter with format = {0:p4} but when I enter 2 for example, the value is automatically multiplied by 100 and converted to 200.0000%. I don't want it to automatically multiply my input value by 100. How can I prevent that?
Hetali
Telerik team
 answered on 09 Dec 2021
1 answer
878 views

My client wanted to have input fields that were numeric (no text allowed). So after a long search and many experiments I managed to get it working. The Input field is a numeric textbox without spinners, in a grid

        <kendo-grid-column format="c1" [width]="100" field="jan" title="Jan {{ convertedYear }}" [editable]="editMode" [headerStyle]="currentMonth(0)">
          <ng-template
          kendoGridEditTemplate
          let-column="column"
          let-dataItem
          let-formGroup="formGroup">
          <kendo-numerictextbox [spinners]="false" [formControl]="formGroup.get(column.field)">
        </kendo-numerictextbox>
        </ng-template>
        </kendo-grid-column>

The problem is ... that values are shown as currency values, even when they are 0. For all numbers that would be fine, except for the 0, which they want to be a plain 0. example below

I tried changing the format="c1" ... but any changes there are not possible, and there is no way to know what value the field will hold in the column itself.

I tried changing the ng-template with [format]="formatOptions" and then setting them, but that changes the format in the numerictextbox field and not the column representation.

is there a way to conditionally format the column cell formatting on the condition being 0 ...

 

thank you for the help

Martin Bechev
Telerik team
 answered on 07 Dec 2021
Top users last month
Mark
Top achievements
Rank 1
Yurii
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Hon
Top achievements
Rank 1
Iron
Deltaohm
Top achievements
Rank 3
Bronze
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?