joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
75 stars 56 forks source link

How to exclude column from export #148

Open pratikdhavale opened 6 years ago

pratikdhavale commented 6 years ago

I need to exclude particular column from export like csv file. Currently there is no any configuration exists. Please help me.

pratikdhavale commented 6 years ago

I have implemented some stuff by using reflections to exclude particular column from extract like csv, tsv etc. Soon I will commit the changes. If any one wants email me pratikdhavale@gmail.com

pratikdhavale commented 6 years ago

For code changes please go to https://pratikdhavale.wordpress.com/2017/12/24/mvcgrid-net-exclude-column-from-export/. Suggestions always welcome. Please reply me if you have any queries.

anlebu commented 6 years ago

I had the same issue, I replaced the original export rendering with a custom one before I started. So I just named the columns I wanted to exclude with a name starting with Action, set the Header text to anything you want.
.RemoveRenderingEngine("export") .AddRenderingEngine("export", typeof(TabDelimitedRenderingEngine)) .WithAuthorizationType(AuthorizationType.AllowAnonymous) .AddColumns(cols => { cols.Add("Action1").WithHeaderText("")

Then on the RenderingEngine, I excluded any column that started with the word Action

EligioMH commented 4 years ago

Thanks @anlebu, great solution. You save me many work ;)