Completed
Last Updated: 02 Jul 2015 14:57 by ADMIN
Imported User
Created on: 24 Mar 2012 23:53
Category: Kendo UI for jQuery
Type: Feature Request
184
Ability to specify data format (MVVM)
It would be convenient if you could specify the output format using a data attribute such as the following rather than having to write a new viewmodel function:
 
<span data-format="{0:C}" data-bind="text: amount"></span>

Currently you have to bind the element to a new viewmodel function which doesn't lend itself to the observable concept with remote data sources.
13 comments
ADMIN
Telerik Admin
Posted on: 02 Jul 2015 14:57
It is documented here, Victor: http://docs.telerik.com/kendo-ui/framework/mvvm/bindings/text#text-formatting
victor
Posted on: 02 Jul 2015 13:09
Please document how to do this on the new release.
ADMIN
Telerik Admin
Posted on: 24 Jun 2015 15:44
Not yet, but we are aware of your increased interest in it and will look into the possibility to include support for data-format in future releases.

In the meantime I hope you can utilize the workaround depicted by Nick.

Update: This functionality is included in Q2 2015
victor
Posted on: 20 Jan 2015 13:37
Scott example is going in the right direction 
victor
Posted on: 20 Jan 2015 13:34
I really need a way to format the output and in the sametime keep the binding of the variable so when it change it get updated with the right format.
David Keaveny
Posted on: 11 Aug 2014 04:46
jasonm23 has a nice solution: writing a custom binder. Have a look at https://github.com/jasonm23/jasonm23.ruhoh.com/blob/master/_posts/kendo-data-bind-formatted.md for an example of creating a currency binding. The advantage of this approach is that this is a global setting, and really helps enforce consistency without having to remember to set data-format="{0:c"} on each element.
Guillermo
Posted on: 05 May 2014 18:36
Here some useful mvvm extensions including textformat, that use the kendo.tostring method...
https://github.com/glondono/kendo-mvvm-extensions
Imported User
Posted on: 21 Apr 2014 18:52
Isn't this already implemented?
Maxim
Posted on: 11 Mar 2014 22:11
Why not override text binding like so [http://jsfiddle.net/QrczG/6/]
Imported User
Posted on: 24 Jan 2014 01:57
Thanks for pointing out the workaround, but this should be standard functionality as well as the ability to do simple string manipulation like string concatenation. 
Scott
Posted on: 28 Oct 2013 01:48
For those interested, there is a good workaround for this here:  http://jsfiddle.net/korchev/urAPV/1/
Scott
Posted on: 28 Oct 2013 01:22
This would make life so much easyer!!
Jaap
Posted on: 10 Apr 2012 14:01
Or perhaps like this: <span data-bind="text: {mydatefield:d}"/>
Because you can bind multiple properties.