Unplanned
Last Updated: 08 Aug 2024 08:34 by ADMIN
Bruno
Created on: 01 Aug 2024 11:17
Category: Grid
Type: Feature Request
2
column-command template does not access grid datasource

column-command template does not access datasource as an ordinary column template.

<kendo-grid name="grid">
    <columns>
        <column field="ProductID" title="ID" />
        <column title="Column" template="#=columnTemplate(data.ProductID)#" />
        <column title="ColumnCommand">
        <commands>
            <column-command name="change" template="#=columnTemplate(data.ProductID)#"></column-command>
        </commands>
    </column>
    </columns>
    <datasource type="DataSourceTagHelperType.Custom" server-filtering="true">
        <transport>
            <read url="@Url.Action("ServerFiltering_GetProducts", "MultiSelect")" />
        </transport>
    </datasource>
</kendo-grid>

<script>
    function columnTemplate(productID) {
        if (productID % 2 == 0)
            return 'even';
        else
            return 'odd';
    }
</script>

Reproduction of the problem:
https://netcorerepl.telerik.com/myurdlbI16kA1TM213

Current behavior:
There is no way to have a dynamic template for column commands that depends on datasource.

Expected/desired behavior:
Having column-command template as column template, making it possible to access data from datasource.

Environment:
Kendo UI version: 2024.2.514

Workaround:
As an alternative solution, I'm using data-bound event, performing a for loop to all rows, but it needs to go line by line, which is not the best solution for large data.

0 comments