Filtering grid

2 posts, 0 answers
  1. Matt
    Matt avatar
    1 posts
    Member since:
    Aug 2014

    Posted 29 Aug 2014 Link to this post

    Hi,
    I'm working on dynamic grid loaded with bounded column based on datatable definition passed in model, and grid is populated by JSON with dynamic Linq. I have a problem with setting the filtering. Sorting and grouping works just fine, but I don't know why for int type I get list which suggests it's a string. Then when filter for example the main Id with IsEqual I get an error: An exception of type 'System.ArgumentException' occurred in System.Core.dll but was not handled in user code. Then I get right results, but icon is showing that it's still searching. What could be tha cause, and how can I fix it? 
  2. Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 02 Sep 2014 Link to this post

    Hello Matt,

    The operators for string will be shown if the property types are not set in the dataSource model. The property types should be explicitly set when using a dynamic model. Assuming that the setup is the same as in the project from the support ticket that you have openned, you should use the following code to set the model fields:
    .DataSource(dataSource => dataSource
        //.SignalR()       
        .Ajax()       
        .PageSize(15)
        .Model(model =>
        {
            foreach (System.Data.DataColumn column in Model.columns)
            {
                model.Field(column.ColumnName, column.DataType);
            }
        })
        .Read(read => read.Action("ShopItems_Read", "Grid"))
    )

    This should also resolve the problem with the exception and the icon since an autocomplete with a startswith filter will not be used for the numeric fields.

    Regards,
    Daniel
    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