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

Computed Columns : How to specify data type?

1 Answer 69 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 12 Jun 2015, 10:45 AM

Hi all,

 

I am using a computed value from a DataSource and displayed in a Grid column.

I discovered that the way to do this is by putting the function in the schema.model

      schema: {
          model: {
                       id: "ID",
                orderValue: function () {
                          // calculate a double value
                          return orderTotal;
                       },

 

And that I put it in my Gird with this ....

 

{ field: "orderValue()", title: "Order Total Value", width: "10&" },

 But if I put a filter on that column, it seems to be assuming it's a string type.

 I may be missing some config.  Normally I would specify the type in the field def in the DataSource but, as seen above, in this case I am using a function (not a plain field def)

 

Any help would be great.  

 Many thanks.

Chris

 

 

1 Answer, 1 is accepted

Sort by
0
Boyan Dimitrov
Telerik team
answered on 16 Jun 2015, 01:12 PM

Hello Chris,

Setting a function for the schema.model is not supported scenario. In order to achieve the described functionality I would suggest you to use the schema.parse and calculate a field. 

Using this approach it is possible to set the type for the custom field. 

Regards,
Boyan Dimitrov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Data Source
Asked by
Chris
Top achievements
Rank 1
Answers by
Boyan Dimitrov
Telerik team
Share this question
or