Replace cell value in specific column

4 posts, 0 answers
  1. Luke
    Luke avatar
    4 posts
    Member since:
    Jul 2016

    Posted 13 Jul Link to this post

    In the datasource of my kendo grid, there is a column which contains numbers as values. Consider them as a code. So is there a way to replace those numbers with a string which is provided with a property file or a json when creating the grid?

    I can use a function to replace value before creating the grid, but then again it is a costly operation to replace in that manner if there are many records. If there is some other way to set the string as a title when hover over cell, that would be helpful too. 
  2. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 15 Jul Link to this post

    Hi Luke,

    There are three possible ways to manipulate the Grid data - before, during, or after it is rendered inside the widget table.

    1) use a parse function to change the data before it is used by the Kendo UI DataSource instance of the Grid

    http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-schema.parse

    2) use a column template to change how the data is displayed in the Grid cells

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-columns.template

    3) use the Grid's dataBound event to change how the data is displayed after it has been rendered. The dataBound event will also allow you to modify the HTML rendering of the Grid table cell elements (which is not possible with a column template, but is possible with a row template)

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#events-dataBound

    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-rowTemplate
     
    http://docs.telerik.com/kendo-ui/api/javascript/ui/grid#configuration-altRowTemplate

    Here is one more demo that you may find useful if you decide to follow option (3):

    http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/style-rows-cells-based-on-data-item-values

    Finally, here is how to use a Kendo UI Tooltip to show additional information when hovering over Grid cells:

    http://docs.telerik.com/kendo-ui/controls/data-management/grid/how-to/grid-with-kendo-ui-tooltip

    Regards,
    Dimo
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
  3. Kendo UI is VS 2017 Ready
  4. Luke
    Luke avatar
    4 posts
    Member since:
    Jul 2016

    Posted 25 Jul in reply to Dimo Link to this post

    Great. Another question. I have a 'number' type column in my grid. Is there any way to list min/max/ average/ sum/ count properties of the column, in the 'column menu' ?
  5. Dimo
    Admin
    Dimo avatar
    8332 posts

    Posted 25 Jul Link to this post

    Hello Luke,

    I am afraid the column menu does not provide such a functionality. Please display column aggregates in the footer row:

    http://demos.telerik.com/kendo-ui/grid/aggregates

    Regards,
    Dimo
    Telerik by Progress
    Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
Back to Top
Kendo UI is VS 2017 Ready