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

AutoGenerate columns format

1 Answer 268 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Robert Madrian
Top achievements
Rank 1
Veteran
Robert Madrian asked on 05 Apr 2017, 09:17 AM

Hello,

I use the following MVC Grid with AutoGenerate columns because we use a query builder and the result are always different resultsets with different columns...

the Problem with that solution is the Format for specific columns like date, datetime and boolean, because they are not formatted the right way

is there a possibility to format specific columns if to use AutoGenerate columns?

 

@(Html.Kendo().Grid<dynamic>()
      .Name("gridEQ")
      .Columns(columns => columns.AutoGenerate(true))
      .Pageable()
      .Sortable()
      .Scrollable(s => s.Height("auto"))
      .NoRecords()
      .Filterable(f => f.Enabled(false))
      .AutoBind(false)
      .DataSource(dataSource => dataSource
          .Ajax()
          .PageSize(100)
          .Read(read => read.Action("ReadAsync", "Home").Data("GetQuerySQL"))
          .Events(e => e.Error("gridError"))
      )
)

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 06 Apr 2017, 04:11 PM
Hello Robert,

It is not possible to apply settings to auto-generated columns in the Grid. However, you could consider following the approach in this sample to replace auto-generated columns with dynamically building the Columns collection:
Bind the Grid to DataTable

If you want to take a quick look at the main logic of the example, check this file.

Regards,
Tsvetina
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Robert Madrian
Top achievements
Rank 1
Veteran
Answers by
Tsvetina
Telerik team
Share this question
or