Insert calls update URL

Sep 18, 2013 at 1:46 PM
Hi Tomasz,

When I save an inserted record, the EditUrl is called. I expected the UpdateUrl to be triggered. What might be wrong? The "code" looks quite "standard":
var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<Assessary.Models.JQGrid.QuestionFormattedModel>("questions",
dataType: Lib.Web.Mvc.JQuery.JqGrid.JqGridDataTypes.Json,
methodType: Lib.Web.Mvc.JQuery.JqGrid.JqGridMethodTypes.Post,
editingUrl: Url.Action("UpdateQuestion"),
rowsNumber: 10,
pager: true,
sortingName: "Ordinal",
sortingOrder: Lib.Web.Mvc.JQuery.JqGrid.JqGridSortingOrders.Asc,
subgridEnabled: true,

    subgridHelper: new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<Assessary.Models.JQGrid.AnswerFormattedModel>("answers",
        dataType: Lib.Web.Mvc.JQuery.JqGrid.JqGridDataTypes.Json,
        editingUrl: Url.Action("UpdateAnswer"),
        methodType: Lib.Web.Mvc.JQuery.JqGrid.JqGridMethodTypes.Post,
        pager: true,
        rowsNumber: 10,
        sortingName: "Ordinal",
        sortingOrder: Lib.Web.Mvc.JQuery.JqGrid.JqGridSortingOrders.Asc,
        url: Url.Action("AnswersSubgrid"),
        viewRecords: true
    ).AddActionsColumn("actions",
            inlineEditingOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Keys = true },
            deleteOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorDeleteActionOptions() { Url = Url.Action("DeleteAnswer") })
       .Navigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorOptions() { Add = false, Edit = false, Delete = false })
       .InlineNavigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorOptions() { Edit = false, 
                            AddActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorAddActionOptions() { RowId = "_empty" }, 
                            ActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Url = Url.Action("InsertAnswer") } }),

url: Url.Action("Questions"),
viewRecords: true
).AddActionsColumn("actions",
    inlineEditingOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Keys = true },
    deleteOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorDeleteActionOptions() { Url = Url.Action("DeleteQuestion") })
.Navigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorOptions() { Add = false, Edit = false, Delete = false, Search = true })
.InlineNavigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorOptions() {Edit = false,
                    AddActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorAddActionOptions() { RowId = "_empty" }, 
                    ActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Url = Url.Action("InsertQuestion") } 
                 }
    );
As a work around I Can check the rowId, but I rather like the InsertUrl to be called. Guess I missed the point here...

Thanks for your help,
Gerard
Coordinator
Sep 18, 2013 at 9:38 PM
Hi Gerard,

It seems that jqGrid internals have changed in latest version and now different option is being used, try modyfing your InlineNavigator calls like this:
.InlineNavigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorOptions() { Edit = false, AddActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorAddActionOptions() { RowId = "_empty", Options = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Url = Url.Action("InsertAnswer") } })
and
.InlineNavigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorOptions() {Edit = false, AddActionOptions = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorAddActionOptions() { RowId = "_empty", Options = new Lib.Web.Mvc.JQuery.JqGrid.JqGridInlineNavigatorActionOptions() { Url = Url.Action("InsertQuestion") } })
Regards,
Tomasz Pęczek
Sep 22, 2013 at 9:07 AM
Yes that works fine, thanks!