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

Modify Column Template On Runtime with javascript

1 Answer 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ifdev02
Top achievements
Rank 1
Ifdev02 asked on 01 Oct 2012, 10:00 AM
Hello
I have tried and search for solution to modify Column template 
e.g.

$("#gridscreenerconfigs").kendoGrid({
                groupable: false,
                sortable: false,
                scrollable: {
                    virtual: true
                },
                filterable: false,
                pageable: false,
                columns: [{
                    field: "fEnable",
                    title: "Enable"
                }, {
                    field: "fCategories",
                    title: "Screener"
                }, {
                    field: "fRange",
                    title: "Range"
                }, {
                    field: "fReorder",
                    title: "Order"
                }, {
                    command: "destroy",
                    title: "Remove"
                }
                ]
            });

i tried some thing like

var grid = $("#gridName").data("kendoGrid");
            grid.columns = [];
            $("#gridscreenerresult").kendoGrid({
                groupable: false,
                sortable: {
                        mode: "multiple",
                        allowUnsort: true
                },
                reorderable: true,
                columnMenu: true,
                scrollable: {
                    virtual: true
                },
                filterable: false,
                resizable: true,
                pageable: {
                    refresh: true,
                    pageSizes: true
                },
                columns: columnfield2
            });
            grid.refresh();

Nothing works so far, is it possible at all?


Hi If adding removing columns not work during runtime with javascript then can you guys show me how to show / hide columns on runtimes programatically? this way i can still complete my project. If all is not well, i will have to roll back to Telerik Ajax instead - spent tons of times on Kendo already.

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 02 Oct 2012, 01:58 PM
Hi Joe,

You can hide and show Grid columns with the hideColumn( int index ) and showColumn( int index ) methods.

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