Kendo Grid with filtering on Aggregate Child property

4 posts, 0 answers
  1. Vincent
    Vincent avatar
    7 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2014 Link to this post

    Given the following data model:

         Product
              Id (int)
              Name (string)
              VapourPressure (double)
              Components (IEnumerable<Component>)

          Component
              Id (int)
              Name (string)

    I want to create a grid using these that displays the data. In this case Name, VapourPressure, Components. The components should be displayed in a HTML list. Of course I want to be able to filter on the presence of 'components' in the Components.

    My current code is attached.

    I have got displaying the components working, although I needed a workaround because any '+' characters are stripped from the template parameter. If there is another way to do this I would like to hear it.

    What I don't have working is the filtering on components. First of all the drop down doesn't work correctly because the options loaded from AJAX are not shown. If the dropdown is instantiated outside the grid everything works fine.  How do I get the dropdown working?
  2. Vincent
    Vincent avatar
    7 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2014 in reply to Vincent Link to this post

    It seems I cannot edit my original post. When filtering this happens now:

    [NullReferenceException: Object reference not set to an instance of an object.]
    Kendo.Mvc.Infrastructure.Implementation.FilterNodeVisitor.Visit(PropertyNode propertyNode) +43
    Kendo.Mvc.Infrastructure.Implementation.PropertyNode.Accept(IFilterNodeVisitor visitor) +10
    Kendo.Mvc.Infrastructure.FilterDescriptorFactory.Create(String input) +128
    Kendo.Mvc.UI.DataSourceRequestModelBinder.BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) +213
    System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +337
    System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +105
    System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +743
    System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +14
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
    System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +343
    System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
    System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
    System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
  3. Vincent
    Vincent avatar
    7 posts
    Member since:
    Apr 2013

    Posted 21 Oct 2014 in reply to Vincent Link to this post

    I got somewhat further. Changes the 'operator' to 'iseq'.

    However the request is now sent as: sort=&page=1&group=&filter=Componenten~eq~'%5Bobject+Object%5D'.
    How can the 'Id' of the component be sent?
  4. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 23 Oct 2014 Link to this post

    Hi Vincent,

    Filtering collections through the filterMenu is not supported out of the box. Similar behavior could be achieved by using a custom function that removes the default value binding and the change event of the element used in the filter row. Once this is done you can initialize a widget of your choice and build the filter expressions manually or pass them as an additional parameter along with the Grid's read request, then handle them on the server. I am afraid however, that implementing such solution is beyond the scope of our support services.

    Regards,
    Alexander Popov
    Telerik
     

    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

     
Back to Top