public CGrid(Func <QueryDictionary <StringValues>, ItemsDTO <T> > dataService, QueryDictionary <StringValues> query, bool renderOnlyRows, Action <IGridColumnCollection <T> > columns = null, CultureInfo cultureInfo = null) { _dataService = dataService; Items = new List <T>(); //response.Items; Url = null; _query = query; //set up sort settings: _settings = new QueryStringGridSettingsProvider(_query); Sanitizer = new Sanitizer(); if (cultureInfo != null) { Strings.CultureInfo = cultureInfo; } EmptyGridText = Strings.DefaultGridEmptyText; Language = Strings.Lang; _annotations = new GridAnnotaionsProvider(); //Set up column collection: _columnBuilder = new DefaultColumnBuilder <T>(this, _annotations); _columnsCollection = new GridColumnCollection <T>(this, _columnBuilder, _settings.SortSettings); ComponentOptions = new GridOptions(); ApplyGridSettings(); Pager = new GridPager(query); ComponentOptions.RenderRowsOnly = renderOnlyRows; columns?.Invoke(Columns); }
public CGrid(string url, IQueryDictionary <StringValues> query, bool renderOnlyRows, Action <IGridColumnCollection <T> > columns = null, CultureInfo cultureInfo = null) { _dataService = null; _dataServiceAsync = null; Items = new List <T>(); _selectedItems = new List <object>(); _httpClient = null; Url = url; _query = query as QueryDictionary <StringValues>; //set up sort settings: _settings = new QueryStringGridSettingsProvider(_query); Sanitizer = new Sanitizer(); if (cultureInfo != null) { Strings.Culture = cultureInfo; } EmptyGridText = Strings.DefaultGridEmptyText; Language = Strings.Lang; _annotations = new GridAnnotationsProvider(); //Set up column collection: _columnBuilder = new DefaultColumnBuilder <T>(this, _annotations); _columnsCollection = new GridColumnCollection <T>(this, _columnBuilder, _settings.SortSettings); ComponentOptions = new GridOptions(); ApplyGridSettings(); Pager = new GridPager(query); ComponentOptions.RenderRowsOnly = renderOnlyRows; columns?.Invoke(Columns); Mode = GridMode.Grid; CreateEnabled = false; ReadEnabled = false; UpdateEnabled = false; DeleteEnabled = false; }
private CGrid(HttpClient httpClient, string url, Func <QueryDictionary <StringValues>, ItemsDTO <T> > dataService, Func <QueryDictionary <StringValues>, Task <ItemsDTO <T> > > dataServiceAsync, IQueryDictionary <StringValues> query, bool renderOnlyRows, Action <IGridColumnCollection <T> > columns = null, CultureInfo cultureInfo = null, IColumnBuilder <T> columnBuilder = null) { _dataServiceAsync = dataServiceAsync; _dataService = dataService; _selectedItems = new List <object>(); Items = new List <T>(); //response.Items; Url = url; _httpClient = httpClient; _query = query as QueryDictionary <StringValues>; //set up sort settings: _settings = new QueryStringGridSettingsProvider(_query); Sanitizer = new Sanitizer(); if (cultureInfo != null) { CultureInfo.CurrentCulture = cultureInfo; } EmptyGridText = Strings.DefaultGridEmptyText; Language = Strings.Lang; _currentPagerODataProcessor = new PagerGridODataProcessor <T>(this); _currentSortODataProcessor = new SortGridODataProcessor <T>(this, _settings.SortSettings); _currentFilterODataProcessor = new FilterGridODataProcessor <T>(this, _settings.FilterSettings, _settings.SearchSettings); _currentSearchODataProcessor = new SearchGridODataProcessor <T>(this, _settings.SearchSettings); _currentExpandODataProcessor = new ExpandGridODataProcessor <T>(this); _annotations = new GridAnnotationsProvider(); //Set up column collection: if (columnBuilder == null) { _columnBuilder = new DefaultColumnBuilder <T>(this, _annotations); } else { _columnBuilder = columnBuilder; } _columnsCollection = new GridColumnCollection <T>(this, _columnBuilder, _settings.SortSettings); ComponentOptions = new GridOptions(); ApplyGridSettings(); Pager = new GridPager(query); ComponentOptions.RenderRowsOnly = renderOnlyRows; columns?.Invoke(Columns); Mode = GridMode.Grid; CreateEnabled = false; ReadEnabled = false; UpdateEnabled = false; DeleteEnabled = false; ButtonComponents = new QueryDictionary <(string Label, Nullable <MarkupString> Content, Type ComponentType, IList <Action <object> > Actions, IList <Func <object, Task> > Functions, object Object)>(); }