Example #1
0
        /// <summary>
        /// Creates a new List control.
        /// </summary>
        /// <param name="requestContext">The request helper.</param>
        /// <param name="metadata">The model metadata.</param>
        /// <param name="model">The current model.</param>
        public FWListControl(FWRequestContext requestContext, ModelMetadata metadata, IEnumerable model)
        {
            RequestContext = requestContext;
            Data           = model;

            if (model is IFWPagination pagination)
            {
                _paginator = new FWPaginator(pagination);
            }
        }
Example #2
0
        private void InitializeDataFiltering(IFWPagination pagination)
        {
            _paginator = new FWPaginator(pagination);

            _sortInfo = new Dictionary <string, FWSortDirection>();
            var sortInfo = (pagination as IFWDataOptions).SortInfo;

            if (sortInfo != null)
            {
                foreach (var info in sortInfo)
                {
                    _sortInfo.Add(info.SortName, info.SortDirection);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Creates a new List control.
        /// </summary>
        /// <param name="requestContext">The request helper.</param>
        /// <param name="metadata">The model metadata.</param>
        /// <param name="options">Initialization options for the list.</param>
        public FWListControl(FWRequestContext requestContext, ModelMetadata metadata, FWListOptions options)
            : base(options.Id)
        {
            _fullRender    = true;
            _cacheKey      = options.CacheKey;
            RequestContext = requestContext;

            ListType   = metadata.ModelType.GetGenericArguments().First();
            ParentType = metadata.ContainerType ?? metadata.ModelType;

            if (_paginationInterface.IsAssignableFrom(options.FilterType))
            {
                _paginator = new FWPaginator(Activator.CreateInstance(options.FilterType) as IFWPagination);
            }
        }