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

[Solved] Custom Command xhr is not defined error

1 Answer 59 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ankit
Top achievements
Rank 1
Ankit asked on 13 Feb 2013, 11:43 PM
@{Html.Telerik().Grid<ClientDiagnosisAxis>()
                                .Name("Axis2Grid")
                                .Columns(c =>
                                {
                                    c.Bound(o => o.RecordId).Hidden(true);
                                    c.Bound(o => o.VersionId).Hidden(true);
                                    c.Bound(o => o.AxisLevel).Hidden(true);
                                    c.Bound(o => o.DiagnosisCode).Title(Model.DiagnosisVersionDescription);
                                    c.Bound(o => o.DiagnosisCodeShortDescription).Title("Description").Width(400);
                                    if (Model.DiagnosisVersionGRRecordId != 667)
                                    {
                                        c.Bound(o => o.ICD10Code).Title("ICD-10 Code");
                                    }
                                    c.Bound(o => o.Rank);
                                    c.Command(com =>
                                    {
                                        com
                                            .Custom("up")
                                            .DataRouteValues(route =>
                                            {
                                                route.Add(o => o.Rank).RouteKey("rank");
                                                route.Add(o => o.ClientDiagnosisRecordId).RouteKey("cdr");
                                            })
                                            .Ajax(true).ButtonType(GridButtonType.Image)
                                            .Action("MoveUp", "ClientDiagnosis");
                                        com
                                            .Custom("down")
                                            .DataRouteValues(route =>
                                            {
                                                route.Add(o => o.Rank).RouteKey("rank");
                                                route.Add(o => o.ClientDiagnosisRecordId).RouteKey("cdr");
                                            })
                                            .Ajax(true).ButtonType(GridButtonType.Image)
                                            .Action("MoveDown", "ClientDiagnosis");
                                    }).Width(120);
                                })
                                .DataBinding(db => db.Ajax()
                                    .Select("_SelectAxis", "ClientDiagnosis").OperationMode(GridOperationMode.Client)
                                )
                                .ClientEvents(events => events.OnRowSelect("onAxis2Select").OnDataBinding("onAxis2GridBinding").OnComplete("onAxis2Complete"))
                                .Sortable(sorting => sorting.SortMode(GridSortMode.SingleColumn).OrderBy(sortOrder =>
                                {
                                    sortOrder.Add(o => o.Rank).Ascending();
                                }))
                                .Pageable()
                                .Selectable()
                                .Footer(true)
                                .Render();
                            }

Hi

I am using custom command for two buttons on each row.
One is the up action and the other is the down action. When I click on the up button I call "MoveUp" action and I rebind the grid on completion of that command. Same for down button. But I am getting the following error:

ReferenceError: xhr is not defined
...r o=parseInt(p,10);if(isNaN(o)||o<1){return this.pageSize}o=Math.max(o,1);this.c...

The call does not reach the action at all.
Another thing to note is that when it makes the call, it adds the data route values that I defined here to the query string portion of the URL of the current page. I was expecting it to POST it rather.

Any idea where I am going wrong here?

1 Answer, 1 is accepted

Sort by
0
Ankit
Top achievements
Rank 1
answered on 14 Feb 2013, 04:28 PM
Sorry my bad... The parameter names were not matching. That was causing this error. Hope it helps someone.
Tags
Grid
Asked by
Ankit
Top achievements
Rank 1
Answers by
Ankit
Top achievements
Rank 1
Share this question
or