Exemple #1
0
        public SGrid(IEnumerable <T> items, IQueryCollection query)
            : base(items)
        {
            #region init default properties

            Query = QueryDictionary <StringValues> .Convert(query);

            //set up sort settings:
            _settings = new QueryStringGridSettingsProvider(Query);

            Sanitizer     = new Sanitizer();
            EmptyGridText = Strings.DefaultGridEmptyText;
            Language      = Strings.Lang;

            _currentSortItemsProcessor   = new SortGridItemsProcessor <T>(this, _settings.SortSettings);
            _currentFilterItemsProcessor = new FilterGridItemsProcessor <T>(this, _settings.FilterSettings);
            _currentSearchItemsProcessor = new SearchGridItemsProcessor <T>(this, _settings.SearchSettings);
            _currentTotalsItemsProcessor = new TotalsGridItemsProcessor <T>(this);
            AddItemsPreProcessor(_currentFilterItemsProcessor);
            AddItemsPreProcessor(_currentSearchItemsProcessor);
            InsertItemsProcessor(0, _currentSortItemsProcessor);
            SetTotalsProcessor(_currentTotalsItemsProcessor);

            _annotations = new GridAnnotationsProvider();

            #endregion init default properties

            //Set up column collection:
            _columnBuilder     = new DefaultColumnBuilder <T>(this, _annotations);
            _columnsCollection = new GridColumnCollection <T>(this, _columnBuilder, _settings.SortSettings);
            RenderOptions      = new GridRenderOptions();

            ApplyGridSettings();
        }
        public void Init()
        {
            _query = QueryDictionary <StringValues> .Convert((new DefaultHttpContext()).Request.Query);

            _repo = new TestRepository();
            _grid = new TestGrid(_repo.GetAll());
        }
Exemple #3
0
        public string GetState()
        {
            var queryDictionary = QueryDictionary <StringValues> .Convert(_query);

            string jsonQuery = JsonConvert.SerializeObject(queryDictionary, new StringValuesConverter());

            return(jsonQuery.GridStateEncode());
        }
        public void Init()
        {
            HttpContext context = new DefaultHttpContext();

            _pager = new GridPager(QueryDictionary <StringValues> .Convert(context.Request.Query));
        }
Exemple #5
0
 public SGridCore(IEnumerable <T> items, IQueryCollection query, IColumnBuilder <T> columnBuilder = null)
     : this(items, QueryDictionary <StringValues> .Convert(query), columnBuilder)
 {
 }
Exemple #6
0
 public SGridCore(IEnumerable <T> items, IQueryCollection query, bool renderOnlyRows,
                  string pagerViewName = GridPager.DefaultPagerViewName, IColumnBuilder <T> columnBuilder = null)
     : this(items, QueryDictionary <StringValues> .Convert(query), renderOnlyRows, pagerViewName, columnBuilder)
 {
 }