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

Cannot use .Filterable in Kendo Grid

3 Answers 134 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tormentor
Top achievements
Rank 1
Tormentor asked on 27 May 2013, 08:55 AM
My problem is that everytime i use the .Filterable it is refreshing . . 


Controller:

public partial class ApplicantController : Controller
    {
        Entities context = new Entities();

        public ActionResult Index()
        {
            return View();
        }
        public ActionResult GetApplicant([DataSourceRequest] DataSourceRequest request)
        {
                IQueryable<APPLICANT> applicants = context.APPLICANTs;
                DataSourceResult result = applicants.ToDataSourceResult(request);
                return Json(result,JsonRequestBehavior.AllowGet);
    
        }

        public ActionResult UpdateApplicant([DataSourceRequest] DataSourceRequest request, APPLICANT applicant)
        {
            var applicantToUpdate = context.APPLICANTs.First(app => app.APPLICANT_ID == applicant.APPLICANT_ID);

            TryUpdateModel(applicantToUpdate);

            context.SaveChanges();

            return Json(ModelState.ToDataSourceResult(),JsonRequestBehavior.AllowGet);
        }
        public ActionResult InsertApplicant([DataSourceRequest] DataSourceRequest request, APPLICANT addappli)
        {
            if (ModelState.IsValid)
            {
                context.APPLICANTs.Add(addappli);
                context.SaveChanges();
            }

            return Json(new[] { addappli }.ToDataSourceResult(request));
        }
}


Index : 

@using Kendo.Mvc.UI
@(Html.Kendo().Grid<_2ndApplicantKendo.Models.APPLICANT>()
    .Name("grid")
    .ToolBar(tb => tb.Create())
        .Columns(columns =>
        {
        columns.Bound(p => p.APPLICANT_LastName).Width(130);
        columns.Bound(p => p.APPLICANT_FirstName).Width(130);
        columns.Bound(p => p.APPLICANT_MiddleName).Width(130);
        columns.Bound(p => p.APPLICANT_Address).Width(130);
        columns.Bound(p => p.APPLICANT_City).Width(130);
        columns.Bound(p => p.APPLICANT_Phone).Width(160);
        columns.Bound(p => p.APPLICANT_Email).Width(160);
         columns.Command(cmd =>
          {
              cmd.Edit();
            
          });
    })
        .Filterable()
        .Groupable()
        .Pageable(page => page.Enabled(true).PageSizes(new Int32[] { 10, 20, 40 }))
        .Scrollable()
        .Editable(a => a.Mode(GridEditMode.PopUp))
        .DataSource(dataSource => dataSource.Ajax()
        .Model(model => model.Id(c => c.APPLICANT_ID))
        .Read("GetApplicant", "Applicant")
        .Update("UpdateApplicant", "Applicant" )
        .Create("InsertApplicant", "Applicant")))

           
            


3 Answers, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 27 May 2013, 10:02 AM
Hello Lesh,


In the current implementation the Grid is configured to use server operations i.e. a request to the read action will be performed on each sort/filter/group etc. operation. You could use the ServerOperation(false) option to specify that these should be performed on the client side.
E.g.
.DataSource(dataSource => dataSource
    .Ajax()
    .ServerOperation(false)
)

I hope this information was helpful for you.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tormentor
Top achievements
Rank 1
answered on 28 May 2013, 01:47 AM
Sir now it doesn't show the values and its blank in index . . . what should i do?
0
Dimiter Madjarov
Telerik team
answered on 28 May 2013, 02:50 PM
Hello Lesh, 


The current behavior of the Grid brings me on the though, that probably the Kendo UI Scripts are not included correctly. Please make sure that the kendo.aspnetmvc.min.js file is included in the application and that it is after the kendo.web.min.js file.

Please take a look at the following documentation page, that I think you might find helpful in the current scenario.

 

Regards,
Dimiter Madjarov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Tormentor
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Tormentor
Top achievements
Rank 1
Share this question
or