Computed Columns : How to specify data type?

2 posts, 0 answers
  1. Chris
    Chris avatar
    6 posts
    Member since:
    Feb 2015

    Posted 12 Jun 2015 Link to this post

    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

     

     

  2. Boyan Dimitrov
    Admin
    Boyan Dimitrov avatar
    1746 posts

    Posted 16 Jun 2015 Link to this post

    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!
     
  3. Kendo UI is VS 2017 Ready
Back to Top