public ActionResult Index(int?stateId) { BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null; if (stateId.HasValue) { var state = _componentState.Get(stateId.Value); if (state != null) { bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>(); } } if (bsGridSettings == null) { bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>() { PageSize = 5, Page = 1 }; } bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search); var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings); var model = new ContributorsViewModel { Grid = gridModel, Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> > { Search = bsGridSettings.Search, New = _gridRepository.GetNewForm(), Order = _gridRepository.GetOrderForm(true) } }; var options = new Dictionary <string, object> { { "pagerUrl", Url.Action("Pager") }, { "getRowsUrl", Url.Action("GetRows") }, { "enableDisableUrl", Url.Action("EnableDisable") }, { "exportExcelUrl", Url.Action("ExportExcel") }, { "updateUrl", Url.Action("Update") }, { "deleteUrl", Url.Action("Delete") }, { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() } }; RequireJsOptions.Add("index", options); return(View(model)); }
public ActionResult Index(int?stateId) { BsGridRepositorySettings <ContributorSearchModel> bsGridSettings = null; //HttpContext.Items["RequestTheme"] = BsTheme.Black; if (stateId.HasValue) { var state = _componentState.Get(stateId.Value); if (state != null) { bsGridSettings = state.ToBsGridRepositorySettings <ContributorSearchModel>(); } } bsGridSettings = new BsGridRepositorySettings <ContributorSearchModel>() { PageSize = 5, Page = 1, //GoTo = BsDirectionType.First }; bsGridSettings.Search = _gridRepository.GetSearchForm(bsGridSettings.Search); bsGridSettings.OrderableColumns = new List <BsColumnOrder> { new BsColumnOrder { Name = "Name", Type = BsOrderType.Descending } }; var gridModel = _gridRepository.ToBsGridViewModel(bsGridSettings, x => x.Id); var model = new ContributorsViewModel { Grid = gridModel, Toolbar = new BsToolbarModel <ContributorSearchModel, ContributorNewModel, List <ContributorOrderModel> > { Search = bsGridSettings.Search, New = _gridRepository.GetNewForm(), Order = _gridRepository.GetOrderForm(true) } }; var options = new Dictionary <string, object> { { "pagerUrl", Url.Action("Pager") }, { "getRowsUrl", Url.Action("GetRows") }, { "enableDisableUrl", Url.Action("EnableDisable") }, { "exportExcelUrl", Url.Action("ExportExcel") }, { "updateUrl", Url.Action("Update") }, { "deleteUrl", Url.Action("Delete") }, { "editComponents", RequireJsHtmlHelpers.ToJsonDictionary <EditComponents>() }, { "countUrl", Url.Action("Count") } }; RequireJsOptions.Add("index", options); return(View(model)); }