.ServerOperation(false) and filter not working

3 posts, 0 answers
  1. Vince
    Vince avatar
    12 posts
    Member since:
    Dec 2016

    Posted 03 Jan Link to this post

    Hi Team,

    I am working on a Client-Side paging grid (ServerOperation(false)). However, the web still send a request to the server when I click the paging and sorting button. Also, the filter doesn't work. I can see the filter icon, but when I click on it, nothing happens.

    My view:

    @model IEnumerable<INSYNC_Test.Models.Staffs>

    @{
        ViewBag.Title = "Index";
    }

    <h2>Index</h2>

    @(Html.Kendo().Grid(Model).Name("staffs").Columns(c =>
    {
        c.Bound(p => p.Firstname);
        c.Bound(p => p.Lastname);
        c.Bound(p => p.JobTitle);

    })
    .DataSource(d=>d
    .Ajax()
    .ServerOperation(false)
    )
    .Pageable()
    .Filterable()
    .Sortable()
    )

     

     

    My controller:

    using INSYNC_Test.Models;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.Mvc;

    namespace INSYNC_Test.Controllers
    {
        public class testController : Controller
        {
            // GET: test
            public ActionResult Index()
            {
                var db = new OSHODSEntities();
                var staffs = db.Staffs.Select(p => new Models.Staffs
                {
                    ID = p.ID,
                    Firstname = p.Firstname,
                    Lastname = p.Lastname,
                    JobTitle = p.JobTitle,
                    locat = p.locat,
                    dept = p.dept,
                    status = p.status,

                });
                return View(staffs);
            }
        }
    }

     

    my viewmodel:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;

    namespace INSYNC_Test.Models
    {
        public class Staffs
        {
            public int ID { get; set; }
            public string Firstname { get; set; }
            public string Lastname { get; set; }
            public string JobTitle { get; set; }
            public string locat { get; set; }
            public string dept { get; set; }
            public int status { get; set; }
        }
    }

  2. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 05 Jan Link to this post

    Hello Vince,

    I examined the provided same and as far as I can see you are bind to the View method which perform a server side request when doing paging and filtering. I would recommend you to configure the grid code similar to the example in the following help article.

    Please give this suggestion a try and let me know about the result.

    Regards,
    Kostadin
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. Vince
    Vince avatar
    12 posts
    Member since:
    Dec 2016

    Posted 06 Jan in reply to Kostadin Link to this post

    Thanks so much for your help. I found the problem is that I have two  "@Scripts.Render("~/bundles/jquery")" in my master page. As long as I remove one of them, the code works.
Back to Top