Grid server side binding and client side paging, sorting etc

14 posts, 0 answers
  1. Dima
    Dima avatar
    5 posts
    Member since:
    Feb 2013

    Posted 25 Feb 2013 Link to this post

    Hello,

    Is there any way to bind my grid with all my data at the server side and manipulate it at the client side without making any posts(paging, sorting, etc)?

    Thanks in advance,
    Dzmitry
  2. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 27 Feb 2013 Link to this post

    Hello Dima,

    This can be achieved by setting DataSource ServerOperation setting to false and pass the data to the Grid constructor. Please refer to this online demo for an sample code (use the tab of the code view to select the ASP.NET MVC version of the demo).

    All the best,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Dima
    Dima avatar
    5 posts
    Member since:
    Feb 2013

    Posted 28 Feb 2013 Link to this post

    Thanks for your fast reply. Any chance to use column.Template instead column.ClientTemplate?
    Because after add this line:
    .DataSource(dataSource => dataSource.Ajax()
        .ServerOperation(false)
    
    Any code inside of Template method is ignored and code inside of ClientTemplate is used.
    
    Thanks in advance,
    Dzmitry
  4. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 01 Mar 2013 Link to this post

    Hello Dima,

    I'm afraid that when client operation mode or AJAX binding is used, the use of ClientTemplates is required.

    Regards,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Dima
    Dima avatar
    5 posts
    Member since:
    Feb 2013

    Posted 01 Mar 2013 Link to this post

    Hi Rosen,

    Can i achieve my goal to enable paging at the client side. For example, at the server i load all data that i want to be bound to my grid without enabling paging. When page is loaded, can i set additional options to grid by the js like this:

    $("#grid").kendoGrid({pageSize:10, pageable:true});

    Is there any chance that this kind of solution can be used? :)

    In this case, i can create additional wrappers for this purpose to generate js like this to do any kind of work and to be able to use server side templates for my grid.

    Thanks in advance,
    Dima
  6. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 01 Mar 2013 Link to this post

    Hi Dima,

    The client templates are required in order the Grid to be rendered, when created as result of some client operation, like paging for example. Server templates will require server template and server rendering.

    All the best,
    Rosen
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  7. Bob
    Bob avatar
    123 posts
    Member since:
    Sep 2012

    Posted 08 Jan 2015 in reply to Rosen Link to this post

    I'm having same problem of sever-side hits when I want all client-side.  In my scenario, the grid appears to re-hitting datasource when loading "filter hints" dropdown such as for a string value column after typing a character in filter box.  It does not appear to be re-hitting datasource for the actual filtering.
  8. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 09 Jan 2015 Link to this post

    Hi Bob,

    If I understood your scenario correctly, you are using filter row feature and do not want autocomplete widgets to use AJAX binding in order to retrieve the data. In this case you could use the BindTo option in order to re-populate the filtering widgets with the required information. For example:

    columns.Bound(p => p.ShipName)
                .Width(500)
                .Filterable(ftb => ftb.Cell(cell => cell.Operator("contains")
                    .BindTo((System.Collections.IEnumerable)ViewBag.ShipNames)));
     
    //where  ViewBag.ShipNames is populated similar to the following:
    ViewBag.ShipNames = GetOrders().Select(o => new { o.ShipName }).Distinct();


    Regards,
    Rosen
    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.

     
  9. Bob
    Bob avatar
    123 posts
    Member since:
    Sep 2012

    Posted 09 Jan 2015 in reply to Rosen Link to this post

    Thanks, but I was hoping the grid had the capability to query the JSON data source that it already has pulled down to client.
  10. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 09 Jan 2015 Link to this post

    Hi Bob,

    I'm afraid that this is not possible. Although, their initial configuration might be shared (at least in most case) the filter row widgets and grid widgets uses separate DataSource instances. Which should be populated independently.

    Regards,
    Rosen
    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.

     
  11. Bob
    Bob avatar
    123 posts
    Member since:
    Sep 2012

    Posted 09 Jan 2015 in reply to Rosen Link to this post

    Can this be logged as an enhancement request somewhere? Or configuration setting? I'm working against a rather sensitive database that I have little control over, so re-hitting the datasource when we already have the data for the filter hint/autocomplete dropdown in JSON format seems expensive.
  12. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 12 Jan 2015 Link to this post

    Hello Bob,

    You can log this as a enhancement request in our user voice portal here. When planning for a release we gather and take into account all feedback from the public portal - the most popular request take the highest priority.

    Regards,
    Rosen
    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.

     
  13. Bob
    Bob avatar
    123 posts
    Member since:
    Sep 2012

    Posted 14 Jan 2015 in reply to Rosen Link to this post

    Hi, I've been asked to disable this autocomplete/hint feature on filters if possible.  How would I do this?
  14. Rosen
    Admin
    Rosen avatar
    3253 posts

    Posted 15 Jan 2015 Link to this post

    Hello Bob,

    You could override the filter cell input element and prevent the AutoComplete widget creation by using the Template option, similar to the following: 

    ftb.Cell(cell => cell.Operator("contains").Template("filterCell"))
     
    <script>
        function filterCell(e) {
            e.element.addClass("k-textbox").width("100%");
        }
    </script>

    On a side note. As the discussion diverge far from the original topic of the thread, please open a separate support request if additional questions arise. 

     

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