Searchable & editable column Select Type with entry parameter

Jun 11, 2012 at 2:08 PM
Edited Jun 11, 2012 at 2:10 PM

Hi,

I have a jqgrid constructed like this in my view:

{
    var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<ContactInfoViewModel>("contacts",
        dataType: Lib.Web.Mvc.JQuery.JqGrid.JqGridDataTypes.Json,
        methodType: Lib.Web.Mvc.JQuery.JqGrid.JqGridMethodTypes.Post,
        pager: true,
        rowsNumber: 10,
        caption: "Contact Info",
        sortingName: "FirstName",
        sortingOrder: Lib.Web.Mvc.JQuery.JqGrid.JqGridSortingOrders.Asc,
        url: Url.Action("ContactInfoTest"),
        viewRecords: true,
        autoWidth: true,
        shrinkToFit: true,
        postDataScript: "{ clientId: clientId}").Navigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorOptions() { Search = false },
        editActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorEditActionOptions() { Url = Url.Action("UpdateContact") },
        addActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorEditActionOptions() { Url = Url.Action("InsertContact") },
        deleteActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorDeleteActionOptions() { Url = Url.Action("DeleteContact") }
    );
}

My controller is accessing the defined ViewModel to render the grid.

    [ModelBinder(typeof(ContactInfoViewModelBinder))]
    public class ContactInfoViewModel
    {
        [HiddenInput]
        public Guid ContactID { get; set; }

      ....

        [DisplayName("Country")]
        [JqGridColumnLayout(Alignment = JqGridAlignments.Center)]
        [JqGridColumnSearchable(true, "CountryCodeSelect", "Helper", SearchType = JqGridColumnSearchTypes.Select)]
        [JqGridColumnEditable(true, "CountryCodeSelect", "Helper", EditType = JqGridColumnEditTypes.Select)]
        [JqGridColumnSortable(true)]
        public string CountryName { get; set; }
      ....
     }

My property CountryName is a dropdown. It is why I choose the select type for both edit and search.

My problem is that the action "CountryCodeSelect" require some parameter, normaly if I call it, the URL will be something like this:

/Helper/CountryCodeSelect?clientId=' + '@ViewBag.ClientId' + '&period=' + '@ViewBag.Period'

Since I'm inside the class property I have no ideas how to call this action with parameter.

Thanks in advance for your help.

Coordinator
Jun 12, 2012 at 2:04 PM

Hi,

I have an idea how this issue can be solved by subclassing JqGridColumnSearchableAttribute but I need to test it before publishing. The problem is that I have no access to my enviroment this week so it will not happen sooner than on weekend.

Jun 13, 2012 at 6:33 AM

Hi

It will be great if you can do something on this :)

Coordinator
Aug 21, 2012 at 1:26 PM

Hi,

I'm terribly sorry but somehow this thread went off my radar and I didn't get the solution for you. If this issue is still important to you late me know and I will work on it.

Feb 13, 2013 at 7:01 AM
I'm in the same situation. I need to send a parameter to the ActionResult that returns my select. Any thoughts?