Grid Attribute for columns

Not Answered This post has 0 verified answers | 5 Replies | 2 Followers Thread's RSS feed.

cem ozbas
Points 445
Replied On: Tue, Nov 15 2016 5:17 AM Reply

Hi,

I'm using the infragistic grid and creating a generic grid. My problem now is to say to some class attributes to not show or to be hidden. Exemple:

- I have my model

public class CountryModel

{

public int CountryId { get; set; }

public string Code { get; set; }

public string Name { get; set; }

}

- I have my simple grid. Nothing to do here because it will show generically

@model GridModel

@(

Html.Infragistics().Grid("adm-generic-grid", Model)

)

- My datasource is can be a list of Country, Product or anything else. It is IQuerable<object>. So let's say it is something:

gridModel.DataSource = GetCountries();

GetCountries(){

return new List<Countryl>(){

new Country(){} ....

new Country(){} ....

}.AsQueryable()

}

- It works, I have my grid but I want to hide or show readonly some properties. Do you have some grid attributes for make it possible?

public class CountryModel

{

[GridColumn(Readonly=true, Hidden=true)]   ????

public int CountryId { get; set; }

[GridColumn(Readonly=true, Hidden=true)]   ????

public string Code { get; set; }

public string Name { get; set; }

}

  • Post Points: 20

All Replies

Replied On: Thu, Nov 17 2016 8:21 AM Reply

Hello Cem,

The Grid MVC Wrapper doesn't provide Attributes to show/hide column or to make it read only. You should do this in the GridModel class.

Example:

GridModel gm = new GridModel();

gm.Columns.Add(new GridColumn() { Key = "Column1", Hidden = true });

gm.Features.Add(new GridUpdating() {

ColumnSettings = new List<ColumnUpdatingSetting>() {

new ColumnUpdatingSetting() { ColumnKey = "Column2", ReadOnly = true

}

}

});

Hope this helps,
Martin Pavlov
Infragistics, Inc.

  • Post Points: 20
cem ozbas
Points 445
Replied On: Thu, Nov 17 2016 8:53 AM Reply

Hi Martin,

Thank you for your answer.

That's too bad, actually I'm using a generic grid which take different models, so I can't specify column by column. It would be very nice to have this feature like do the mvc model views then we won't need any column specification. You can maybe create a ticket for this feature and hope to have it in future implementations

Regards

  • Post Points: 20
Replied On: Mon, Nov 21 2016 5:20 AM Reply

Hello Cem,

You can still generate column settings for Updating and Hiding features without knowing your model. And the code will be generic.

As for the suggestion. You can log a Ignite UI Product Idea yourself here: http://ideas.infragistics.com/forums/211535-ignite-ui.

Here are the steps to create your idea:

1. Log into the Infragistics Product Idea site at http://ideas.infragistics.com (creating a new login if needed).

2. Navigate to the product / platform channel of your choice (e.g. WPF, Windows Forms, ASP.NET, HTML5 / Ignite UI, iOS / NucliOS, etc.)

3. Add your product idea and be sure to be specific and provide as much detail as possible.

    • Explain the context in which a feature would be used, why it is needed, why it cant be accomplished today, and who would benefit from it. You can even add screenshots to build a stronger case. Remember that for your suggestion to be successful, you need other members of the community to vote for it. Be convincing!

    • Include a link to this thread in your idea so product management will be able to look back at this case.

Best regards,
Martin Pavlov
Infragistics, Inc.

  • Post Points: 20
cem ozbas
Points 445
Replied On: Mon, Nov 21 2016 5:51 AM Reply

http://ideas.infragistics.com/forums/192360-asp-net/suggestions/17193953-iggrid-model-attributes-for-columns

:)

  • Post Points: 20
Replied On: Tue, Nov 22 2016 10:46 AM Reply

Thank you!

  • Post Points: 5
Page 1 of 1 (6 items) | RSS