Grid.Mvc icon indicating copy to clipboard operation
Grid.Mvc copied to clipboard

Grid.mvc - column containing iCollection

Open arimaze opened this issue 8 years ago • 0 comments

Hi,

My model contain a collection of object. (Any to any relation).

this.ROOT_CAUSE_CATEGORIES = new HashSet<ROOT_CAUSE_CATEGORIES>(); 
I added column using custom rendering with htmlhelper.
columns.Add(o => o.ROOT_CAUSE_CATEGORIES).Titled("Category").Sanitized(false).Encoded(false).Sortable(true).Filterable(true).SetFilterWidgetType("CategoryFilterWidget")
       .RenderValueAs(o => CustomRenderingCategoryColumn(o)).Css("text-center");

But it seems that filter does not work with collection column

Error here in _grid.cshtml:

@helper RenderGridBody()
{
    if (!Model.ItemsToDisplay.Any())
    {

Method 'System.String ToUpper()' declared on type 'System.String' cannot be called with instance of type 'System.Collections.Generic.ICollection1[NCQIAP.ROOT_CAUSE_CATEGORIES]' ` For your information, my others columns filters load with ajax with single values (string or number) are well filtered.

Have you try to implemented a mechanism to allow gridmvc to work with a property model of icollection.

For exemple :

Studends follow courses. 1 course may be followed by many students

I would like a table to display all courses followed by a student and filter only 1 course.

Thanks and best regards

arimaze avatar Aug 21 '17 15:08 arimaze