Search and Edit in same Grid

Sep 30, 2013 at 8:43 AM
Edited Sep 30, 2013 at 8:45 AM
I am trying to incorporate search and edit option in single grid.. and i am having issue on Search of a "select-type" where as for edit select-type wrok fine but not in advance search option . below is my ViewModel.
[ModelBinder(typeof(ItemViewModleBinder))]
    public class ItemViewModel
    {
       #region Properties
         [JqGridColumnSearchable(true, SearchType = JqGridColumnSearchTypes.Text, SearchOperators = JqGridSearchOperators.EqualOrNotEqual)]
        [JqGridColumnEditable(false)]
        public int ItemID { get; set; }

        [JqGridColumnSearchable(true, SearchType = JqGridColumnSearchTypes.Text, SearchOperators = JqGridSearchOperators.TextOperators)]       
        [JqGridColumnEditable(true, EditType = JqGridColumnEditTypes.Text)]
        [StringLength(40)]
        [Required]
        public string ItemName { get; set; }

        

        [ScaffoldColumn(false)]
        [Required]
        public long ItemCategoryID { get; set; }


        [JqGridColumnSearchable(true, "Categories", "Home", SearchType = JqGridColumnSearchTypes.Select, SearchOperators = JqGridSearchOperators.Eq | JqGridSearchOperators.Ne)]
        [JqGridColumnEditable(true, "Categories", "Home", EditType = JqGridColumnEditTypes.Select)]
        [Required]
        public string ItemCategoryName { get; set; }

        [JqGridColumnEditable(true, EditType = JqGridColumnEditTypes.Text)]
        [StringLength(250)]
        [Required]
        public string Remark { get; set; }

        [JqGridColumnEditable(true, EditType = JqGridColumnEditTypes.Text)]
        [StringLength(2)]
        [Required]
        public string isActive { get; set; }
        
        #endregion

        #region Constructor
        public ItemViewModel()
        { }

        public ItemViewModel(tblItem item)
        {
            this.ItemID = Convert.ToInt32(item.ItemID);
            this.ItemName = item.ItemName;
            this.ItemCategoryID = item.ItemCategoryID;
            this.ItemCategoryName = item.tblCategory.ItemCategoryName;
            this.Remark = item.Remark;
            this.isActive = item.isActive;
        }
        #endregion
    }
Please advice whether it is possible to use single grid for both edit and search option. I am using
jquery-1.9.1.min.js
jquery-ui-1.10.3.min.js
jQuery.jqgrid 4.4.4
Coordinator
Sep 30, 2013 at 9:30 AM
Edited Sep 30, 2013 at 9:30 AM
Can you also add your JqGridHelper initialization code (it will be easier to recreate the issue for me)?
Sep 30, 2013 at 9:47 AM
below is the is the initialization code for your kind referance.

@{
    ViewBag.Title = "Item List";

    var grid = new Lib.Web.Mvc.JQuery.JqGrid.JqGridHelper<ITHelpDesk.ViewModel.ItemViewModel>("tblItem",
        caption: "Items",
        dataType: Lib.Web.Mvc.JQuery.JqGrid.JqGridDataTypes.Json,
        footerEnabled: true,
        methodType: Lib.Web.Mvc.JQuery.JqGrid.JqGridMethodTypes.Post,
        pager: true,
        rowsList: new List<int> { 10, 20, 30, 40, 50 },
        rowsNumber: 10,
        sortingName: "ItemName",
        sortingOrder: Lib.Web.Mvc.JQuery.JqGrid.JqGridSortingOrders.Asc,
        url: Url.Action("DisplayItem"),
        userDataOnFooter: true,
        viewRecords: true
     ).Navigator(new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorOptions() { Search = true },
       editActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorEditActionOptions() { Url = Url.Action("UpdateItem") },
       addActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorEditActionOptions() { Url = Url.Action("InsertItem"), Width = 400, Height = 300, Left = 200, },
       deleteActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorDeleteActionOptions() { Url = Url.Action("DeleteItem") },
       searchActionOptions: new Lib.Web.Mvc.JQuery.JqGrid.JqGridNavigatorSearchActionOptions() { AdvancedSearching = true, CloneSearchRowOnAdd = false });
}
and thanks for your swift response.
Oct 9, 2013 at 1:00 PM
Marked as answer by TPeczek on 11/27/2013 at 2:30 AM