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

items.attributes Usage

3 Answers 166 Views
Form
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Veteran
Michael asked on 05 Jun 2020, 04:34 PM

I'm trying to format a numeric text box item with the following:

attributes: {format: "#", decimal: 0}

But it has no efect

Could you give an example of how to achieve the above

 

Thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 08 Jun 2020, 06:24 AM

Hello Michael,

The idea of the items.attribute option is to provide a way of applying a custom attribute to the input element of the field. However, from the provided code you are actually trying to set options to the NumericTextBox widget. To do this, you can use the item.editor and item.editorOptions as follows:

{ 
  field: "Age", 
  editor: "NumericTextBox", 
  editorOptions: { 
    format: "#", 
    decimal: 0 
  } 
},

Here is a Dojo example where the above is demonstrated.

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Michael
Top achievements
Rank 1
Veteran
answered on 08 Jun 2020, 02:20 PM

Thanks Dimitar

That's good. I think it should be decimals (plural), please correct me if I'm wrong

Regards Mike

0
Dimitar
Telerik team
answered on 09 Jun 2020, 04:56 AM

Hello Michael,

Yes, you are correct that the name option is decimals. All the available options for the NumericTextBox can be reviewed in the API documentation:

Regards,
Dimitar
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Form
Asked by
Michael
Top achievements
Rank 1
Veteran
Answers by
Dimitar
Telerik team
Michael
Top achievements
Rank 1
Veteran
Share this question
or