cancel
Showing results for 
Search instead for 
Did you mean: 

Field format is changing from number to text

joerg_arndt
Participant
0 Kudos

Hi Friends,

in sap.m.table I have a number field. As long it is not touched it stays a number. But when I change it, it becomes a string. Is this normal or can I avoid it in any way?

Thanks Joerg

Accepted Solutions (0)

Answers (4)

Answers (4)

joerg_arndt
Participant
0 Kudos

Thanks Viplove,

but sap.m.table expecting sap.m.input and furthermore number, email etc.

But at least, now it works when I parse the string in "change" event and set true in refresh.

oChartModel.refresh();

now.

oChartModel.refresh(true);

Rg. Joerg

former_member340030
Contributor
0 Kudos

Hi Joerg Arndt,

Actually when we bind the property of a control , we have data type for that binding (sap.ui.model.type.<String/Float/Integer..>). I think you need to set that as Integer.

Check out this link for Data Types.

Thanks

Viplove

joerg_arndt
Participant
0 Kudos

Hi Sergio,

it is sap.m.Input with Number format.

In Model under properties I can see the Format is number but the value is changed string like "786". I have function "change" to update a chart. Where I can parse it to number. I managed it once to change the chart while change the values by hand. But I can not make agen.

I tried it like this.

var newValue = parseInt(oEvent.mParameters.newValue);
var oField = sap.ui.getCore().byId(fieldId);
oField.setValue(newValue);

or

var oChartModel = sap.ui.getCore().getModel("CHARTMODEL");
var chartdata = oChartModel.getData();
chartdata.results[0].SEATSMAX = newValue;
oChartModel.setData(chartdata);
oChartModel.refresh();

Both, the chart is not updated.

How is it possible that the value in the Model is changed to string.

I have the same propblem when I want to save data to database. But here I can convert it back to number.

SergioG_TX
Active Contributor
0 Kudos

is your control (number field) a text control? an input control? you could probably force it by using a liveChange event and then running on a formatter function