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

MVC datasource and schema

1 Answer 528 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Felipe Casanova
Top achievements
Rank 1
Felipe Casanova asked on 23 Jul 2012, 11:49 AM
How do you specify where the data is in the response? In js I would specify that the total property is the "count" property and the data is in "data". I don't see how to do this in the MVC extensions.

schema: {
                    total: "count",
                    data: "data",
                    model: {
                        id: "Id",
                        fields: {
                            Id: { editable: false, type: "number" },
                            StartDate: { type: "date" },
                            EndDate: { type: "date" }
                        
                        }
                    }
                }

1 Answer, 1 is accepted

Sort by
0
Vesselin Obreshkov
Top achievements
Rank 2
answered on 24 Jul 2012, 02:20 AM
When using the MVC extensions, you need to either return a DataSourceResult (yourIQueryable.ToDataSourceResult())  object or store your total in a ViewBag.Count variable in your controller and when defining your dataSource => dataSource.Total(ViewBag.Count) will tell the grid your total number of records.
Tags
Grid
Asked by
Felipe Casanova
Top achievements
Rank 1
Answers by
Vesselin Obreshkov
Top achievements
Rank 2
Share this question
or