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

[ScaffoldColumn(false)] column ignored by Grid

4 Answers 700 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Chris asked on 04 Jun 2018, 04:00 PM

HI

I have define a model with a [ScaffoldColumn(false)] column : 

  [ScaffoldColumn(false)]
  public string Column1 { get; set; }

but when I want to show this column in grid but that column not shown : 
 
  columns.Bound(column => column.Column1).Width(100);

After remove the [ScaffoldColumn(false)] from that column,
the column shown correctly.

[ScaffoldColumn(false)] column ignored by Grid internally even if Bound explicitly ? 

How could I show the [ScaffoldColumn(false)] column using Bound column ?

Best regards

Chris

 

 

4 Answers, 1 is accepted

Sort by
0
Preslav
Telerik team
answered on 06 Jun 2018, 11:05 AM
Hi Chris,

You are correct all the "[ScaffoldColumn(false)] " columns are ignored internally, and there is no way to display such a column in the Grid.

What I would suggest is removing the "[ScaffoldColumn(false)] " annotation, and hiding the desired column(if needed) with the ".Hidden()" configuration. For example:

columns.Bound(m => m.Id).Hidden()


Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 07 Jun 2018, 01:21 AM
No, I have test and WORKS : 

columns.Bound(m => m.Id).Visible(true).Hidden();

If developer set Bound() explicitly, I think the Grid control "SHOULD NOT" not display that column,
I think this is a BUG.
 
Best regards 

Chris



0
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
answered on 07 Jun 2018, 01:29 AM

>...and hiding the desired column(if needed) with the ".Hidden()" ...

Yes, but this is not my requirement.

My requirement: I want to show the column even if the column marks as [ScaffoldColumn(false)],
and I want that column pass back (via hidden field - <input type='hidden' name='XXX[0].XXX' ...>) to controller while Form POST.

*I think the Grid control ignore [ScaffoldColumn(false)] columns for AutoGenerateColumn is right, but wrong for Bound() explicitly.

Best regards

Chris

 

 

0
Preslav
Telerik team
answered on 07 Jun 2018, 11:44 AM
Hello Chris,

I understand your point, and I believe it sounds reasonable. However, I consulted with my colleagues, and for the time being, we are not planning to change this default behavior. 

If you need to use the same model for two different grids - one autogenerated, and the other manually bound, you could extend the main model, and change the data annotations in the new one.


Regards,
Preslav
Progress Telerik
Try our brand new, jQuery-free Angular 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
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Answers by
Preslav
Telerik team
Chris
Top achievements
Rank 1
Veteran
Iron
Iron
Share this question
or