Local data binding with update.

4 posts, 1 answers
  1. Xavier
    Xavier avatar
    29 posts
    Member since:
    Jun 2014

    Posted 19 Sep 2014 Link to this post

    I only need to show a few rows (say 5 -100) in my grid so I rather use local binding.  But I need to use inline edit on a date column.
    How do I go about doing this?

    The current solution/examples uses ajax to read the data. I could take that approach and it would result in one extra unnecessary request. The bigger problem is, the query to read the data is a bit complex so I am using Native SQL and I am not sure how to mix that in with Kendo's DataSourceRequest.
    My current code which I know is wrong when it comes to pagination.
    var enterpriseAccounts = db.Database.SqlQuery<EnterpriseAccountsVM>(enterpriseAccountsQuery, new SqlParameter("accountType", AccountType.Enterprise)).ToList();
    return Json(enterpriseAccounts.ToDataSourceResult(request));

    I could solve all my problems by using client side pagination but have updates call the server. Is this possible?

  2. Answer
    Daniel
    Admin
    Daniel avatar
    2231 posts

    Posted 23 Sep 2014 Link to this post

    Hello,

    You can pass the data to the GridBuilder:
    Html.Kendo().Grid(Model)
    and enabled client-side operations with the DataSource ServerOperation method. No read request will be required and the paging, filtering, etc. will be performed on the client but a request will still be sent for updates.

    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.

     
  3. Xavier
    Xavier avatar
    29 posts
    Member since:
    Jun 2014

    Posted 23 Sep 2014 in reply to Daniel Link to this post

    I tried
    ​@model IEnumerable<AccountsPaymentDueKendoVM>
    @(Html.Kendo().Grid(Model)

    but it gives error

    The best overloaded method match for 'Kendo.Mvc.UI.Fluent.WidgetFactory.Grid(System.Data.DataView)' has some invalid arguments

  4. Xavier
    Xavier avatar
    29 posts
    Member since:
    Jun 2014

    Posted 23 Sep 2014 in reply to Xavier Link to this post

    I copied from the sample
    VS2013\Kendo.Mvc.Examples\Areas\razor\Views\grid\local_data_binding.cshtml

    and it works now
    @model IEnumerable<AccountsPaymentDueKendoVM>
     @(Html.Kendo().Grid(Model)

Back to Top