Skip to content

Grid.mvc - column containing iCollection #7

@arimaze

Description

@arimaze

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions