String to int
I am extracting values from the json files using store and model in sencha.
some of the values extracted are int. I want to perform operation on it(mathematical)......but it is a string.
How can i convert this string to int or is there any other way of doing mathematical operation on them.
This is coming from json file-
This is the operation which i want to do
Suppose value of open_value = 30
then output should come 42 and not 3012 which is coming in present case
Ext JS Premium Member
Your variable open_value is being interpreted as a string, and then the + 12 is treated as string concatenation. Try this:
alert(parseInt(open_value,10) + 12);
ExtJS does this for you.
Just specify a field type when you define your Model.
Tags for this Thread