Пример #1
0
        /// <summary>
        /// Configures the column ordering in the DataTable settings which are serialized when rendering the table script.
        /// </summary>
        /// <param name="configuration"></param>
        /// <param name="columns"></param>
        protected virtual void ConfigureColumnOrdering(DataTablesConfiguration configuration, IList <DataTablesColumn <TEntity, TEntityViewModel> > columns)
        {
            var orderedColumns = columns.Where(c => c.OrderingIndex > -1).OrderBy(c => c.OrderingIndex);

            foreach (var column in orderedColumns)
            {
                configuration.Order.Add(new List <string>
                {
                    columns.IndexOf(column).ToString(),
                    column.OrderingDirection == System.ComponentModel.ListSortDirection.Descending ? "desc" : "asc"
                });
            }
        }
Пример #2
0
 /// <summary>
 /// Configures the columns in the DataTable settings which are serialized when rendering the table script.
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="columns"></param>
 protected virtual void ConfigureColumns(DataTablesConfiguration configuration, IList <DataTablesColumn <TEntity, TEntityViewModel> > columns)
 {
     foreach (var column in columns)
     {
         configuration.Columns.Add(new DataTablesConfiguration.DataTablesConfigurationColumn
         {
             Data              = column.PublicName,
             Name              = column.PublicName,
             Title             = column.DisplayName ?? column.PublicName.FirstCharToUpper(),
             Searchable        = column.IsSearchable,
             Orderable         = column.IsOrderable,
             AdditionalOptions = column.AdditionalOptions.DeepClone()
         });
     }
 }
Пример #3
0
 /// <summary>
 /// Allows to configure additional table options.
 /// </summary>
 /// <param name="configuration"></param>
 /// <param name="columns"></param>
 protected virtual void ConfigureAdditionalOptions(DataTablesConfiguration configuration, IList <DataTablesColumn <TEntity, TEntityViewModel> > columns)
 {
     // We don't configure anything here, but we provide a default implementation.
 }
Пример #4
0
        /// <summary>
        /// DataTable constructor. Gets and stores the table identifier.
        /// </summary>
        public DataTable()
        {
            SetTableIdentifier(BuildTableIdentifier());

            _configuration = new DataTablesConfiguration();
        }