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

Grid Ajax call on sorting

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Atanu
Top achievements
Rank 1
Atanu asked on 12 Oct 2012, 08:55 AM
I have a grid as below

@{
    Html.Kendo().Grid<InEnumerable........>()
    .Name("IniParamGrid")
    .HtmlAttributes(new { style = "width: 100%;" })
    .Events(events => events.DataBound("Grid_onRowDataBound"))
    .Events(events => events.Change("Grid_OnRowSelectUID"))  
    .AutoBind(false)
    .Columns(col =>
    {
        col.Bound("NP_PARAM_UID").Hidden();        
        col.Bound("PROCESS_GRP").Title("Process Group").HeaderHtmlAttributes(new { style = "text-align:center;" });
        col.Bound("PARAM_NAME").Title("Parameter Name").HeaderHtmlAttributes(new { style = "text-align:center;" });
        col.Bound("PARAM_VALUE").Title("Parameter Value").HeaderHtmlAttributes(new { style = "text-align:center;" });
        col.Bound("EXTERNAL_ID").Title("Table Name").HeaderHtmlAttributes(new { style = "text-align:center;" });
        col.Bound("EXTERNAL_FK").Title("Key Value").HeaderHtmlAttributes(new { style = "text-align:center;" });
        col.Bound("DEL_FLG").Hidden();
    })
    .DataSource(dataBinding =>
    {
        dataBinding.Ajax().Read(read => read.Action("SrchDataIniParam", "Admin",
            new
                {
                    area = "Admin",
                    strParam1 = ViewBag.Param1
                }))
                .ServerOperation(false);
    })
    .Resizable(resizing => resizing.Columns(true))
    .Selectable() 
    .Reorderable(reorder => reorder.Columns(true))
    .Pageable()
    .Sortable()
    .Filterable()
    .Render();
}

Now the grid loads empty at starup which is ok. But if the user clicks the grid header then also the underlying controller action gets called which is not desirable. I want the grid to get populated on button click which its doing fine.

Please help me to find where I am going wrong.

1 Answer, 1 is accepted

Sort by
0
Accepted
Atanas Korchev
Telerik team
answered on 17 Oct 2012, 06:27 AM
Hi,

 This behavior is by design and cannot be prevented unless you disable sorting. Clicking the sort icon causes the grid to ask for data. As a result the action is called.

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