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

.ServerOperation(false) and filter not working

2 Answers 712 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Vince
Top achievements
Rank 1
Vince asked on 03 Jan 2017, 05:39 PM

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 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 05 Jan 2017, 11:37 AM
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.
0
Vince
Top achievements
Rank 1
answered on 06 Jan 2017, 09:01 PM
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.
Tags
Grid
Asked by
Vince
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Vince
Top achievements
Rank 1
Share this question
or