Hi everyone, I am trying to format every number in my query to 2 decimal places (including zeros) by using "kendo.toString({Attribute}, n2)". A few examples of what I should happen with the numbers are as follows:
1234.56 = 1,234.56
1234 = 1,234.00
1234.5 = 1,234.50
Does anyone have any idea how to do this? I have tried using a script tag in the html of the custom query and I have tried assigning a class to the areas I want the values to be displayed then modified the class with an initialisation script but neither seem to work and I still end up with numbers displaying as 1234.0.
Formatting With kendo.toString() in Custom HTML Query
-
- Posts: 8
- Joined: Mon Dec 02, 2019 3:32 am
-
- Posts: 2413
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Formatting With kendo.toString() in Custom HTML Query
Why not just use a Number format of n instead of # ?
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
-
- Posts: 8
- Joined: Mon Dec 02, 2019 3:32 am
Re: Formatting With kendo.toString() in Custom HTML Query
I've tried what I think you mean but it doesn't seem to do anything either. I think I might be misunderstanding how this is meant to work so I will supply some snippets to hopefully help convey what the problem is.
The last thing I tried was making a new query, changed it to display as a custom HTML query and placed a line like this in it:
Code: Select all
{Budget}
I ended up putting the attribute inside a class that looks something like this:
Code: Select all
<div class="kendoBudget">{Budget}</div>
I think at some point I may have overcomplicated this whole thing but I really don't know. I have tried using a javascript alert to tell me how many elements with the class on them are in the html but the response back is always 0 which is confusing too since there should be hundreds if not thousands of records with that class attached to them (afterall I can read the original number in the query).
I just want a number like "123456.789" that is saved in an attribute at that precision to be displayed in a Custom HTML query as "123,456.79".
Re: Formatting With kendo.toString() in Custom HTML Query
Have you tried this format: #,##0.00
If you set the format on the Object.Amount number attribute as above, this will work both in an HTML cell and a CUSTOM grid query
eg: <<Object.Amount>> or {Amount}
If you set the format on the Object.Amount number attribute as above, this will work both in an HTML cell and a CUSTOM grid query
eg: <<Object.Amount>> or {Amount}
-
- Posts: 8
- Joined: Mon Dec 02, 2019 3:32 am
Re: Formatting With kendo.toString() in Custom HTML Query
This seems to work, I knew I must have been overthinking it, thanks!
Re: Formatting With kendo.toString() in Custom HTML Query
Yeah , most often times when I get stuck it's because of overthinking and forgetting AwareIM is a simplified process, if its getting complex then you going the wrong wayI knew I must have been overthinking it, thanks!