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

[Solved] Unable to hiding Grid Template Column from jquery

1 Answer 399 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sriman
Top achievements
Rank 1
Sriman asked on 12 Sep 2014, 05:42 AM
Hi,

I have the below grid created in .cshtml
.cshtml
@(Html.Kendo().Grid((IEnumerable<FundFeeModel>)null)
                    .Name("Grid")
                    .Columns(columns =>
                    {
                        //columns.Template(@<text></text>).ClientTemplate("<input type='radio' id='rdoselect' value='#=FlatFeeId#' onclick='Javascript:SelectFlatFeeRecord(this)' name='group1' />").Width(90);
                        columns.Template(@<text></text>).ClientTemplate("<input type='radio' id='rdoselect' value='#=FundFeePeriodId#' onclick='Javascript:SelectFundFeePeriodRecord(this)' name='group1' />").Width(90);
                        columns.Bound(p => p.FeeTypeId).Groupable(false).Title("Fee Type").Visible(false);
                        columns.Bound(p => p.FeeTypeName).Groupable(false).Title("Fee Type").Width(300);
                        columns.Bound(p => p.SDate).Title("Start Date").Width(200);
                        columns.Bound(p => p.EDate).Title("End Date").Width(200);
                    })
                    .Pageable()
                    .Sortable()
                    .DataSource(dataSource => dataSource
                    .Ajax()
                    .Read(read => read.Action("GetPeriodwiseFundFees", "FundFee"))
                    )
                    .Filterable()
                    .Pageable(pager => pager.PageSizes(new int[] { 10, 15, 20, 25, 30 })))

From the .js file i am able to hide the bound columns using the following syntax - 
control.hideColumn('FeeTypeId');
control.hideColumn('FeeTypeName');
control.hideColumn('SDate');
control.hideColumn('EDate');

Question - How can I hide the Template Column by setting an Id/Name and using that Id/Name to hide the column from .js?

Note: control.hideColumn(0) doesn't meet my requirement as I need to set this asned on user access permission.

Thanks

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 12 Sep 2014, 10:46 AM
Hi Sriman,


The supported ways to hide a column are by passing the index of the column or the field that it is bound to. So in the case of a template column, the only possible way would be to hide it by index.

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