Bind Grid (and other components) to local datasource

2 posts, 0 answers
  1. Victor
    Victor avatar
    167 posts
    Member since:
    Nov 2010

    Posted 08 Jan 2013 Link to this post

    Hi!
    (see edit - base questions fixed)

    After implementing the grid for some of our core object listings using a combination of server-side and ajax databindings we have realized we would like to speed up the grid sorting/filtering/searching as well as implementing some more advanced scenarios.

    After some reasoning we came up with the idea to use a local datasource and to manipulate evering in memory. However we couldnt find a straight-forward way of doing this. We expected something like:

    @(Html.Kendo().Grid(Model.GridRows)
       //...
           .DataSource(dataSource =>
                            {
                                dataSource.Local()
                                    .Model(model => model.Id(s => s.Id))
                                    .Sort(sort => sort.Add(s => s.Name));
                            })
    )

    However we realize it would be problematic to do CRUD operations using this approach - for that we would prefer to be able to use Ajax.

    So - hopefully I have explained the idea reasonably well. Basically:
    • Is there any good way to use a local datasource (custom js-driven supporting filtering etc)? 
    • Is there any good way to take direct control of the datasource (like @Html.DataSource().... and use that is some way)?

    Edit: We realized we could use dataSource.Ajax().ServerOperation(false) to achieve the base behaviour. We can probably figure out how to do some advanced filtering using the Web demos. The second point we still wonder about though - is it possible to use the datasource more directly? For example using a shared datasource or doing some more custom refreshing scenarios without resorting to an all-javascript approach?

    Thanks
    /Victor
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 10 Jan 2013 Link to this post

    Hi Victor,

     Currently there is no way to create a Kendo DataSource from C#. Every data bound widget which has an ASP.NET MVC wrapper has its own data source. 

     As far as I understand your needs an Ajax data source with disabled server operations would be the best option.

    Regards,
    Atanas Korchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top