This is a migrated thread and some comments may be shown as answers.

Filtering grid

1 Answer 43 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matt
Top achievements
Rank 1
Matt asked on 29 Aug 2014, 12:40 PM
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? 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Sep 2014, 08:51 AM
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.

 
Tags
Grid
Asked by
Matt
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or