[ScaffoldColumn(false)] column ignored by Grid

5 posts, 0 answers
  1. Chris
    Chris avatar
    119 posts
    Member since:
    Oct 2015

    Posted 04 Jun 2018 Link to this post

    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

     

     

  2. Preslav
    Admin
    Preslav avatar
    583 posts

    Posted 06 Jun 2018 Link to this post

    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.
  3. Chris
    Chris avatar
    119 posts
    Member since:
    Oct 2015

    Posted 06 Jun 2018 in reply to Preslav Link to this post

    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



  4. Chris
    Chris avatar
    119 posts
    Member since:
    Oct 2015

    Posted 06 Jun 2018 in reply to Chris Link to this post

    >...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

     

     

  5. Preslav
    Admin
    Preslav avatar
    583 posts

    Posted 07 Jun 2018 Link to this post

    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.
Back to Top