joeharrison714 / MVCGrid.Net

http://mvcgrid.net
MIT License
74 stars 55 forks source link

Problem with columns for properties named "Name" #109

Closed githubassumde closed 7 years ago

githubassumde commented 7 years ago

Hi,

I try to use filtering as described in the demo page: http://mvcgrid.net/demo/filtering My entity has a property named "Name".

Whenever I add this column to the grid definition I get this exception:

There is no grid defined with the name ',MyGrid'

It seems "Name" is also internaly used and now there is a list of names. I did not find a solution to this. Any help is very welcome.

Thanks, Dirk

githubassumde commented 7 years ago

I was able to fix this by changing the name of the column, the GetFilterString call and the filter input:

MVCGridDefinitionTable:

[...]
cols.Add("SomethingElse") [...]
[...]
string nameFilter = options.GetFilterString("SomethingElse");
[...]

Razor view:

[...]
<input [...] data-mvcgrid-type="filter" data-mvcgrid-option="SomethingElse" />
[...]

Sorting and everithing else referencing the name column had to be changed too.