ASP.NET Core - EJ2

Code Examples Upgrade Guide User Guide Demos Support Forums Download
  • Code Examples
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class GridColumnBuilder<T>

    Show / Hide Table of Contents

    Class GridColumnBuilder<T>

    Inheritance
    System.Object
    ControlBuilder
    GridColumnBuilder<T>
    Inherited Members
    ControlBuilder.Output
    ControlBuilder.Context
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: Syncfusion.EJ2.Grids
    Assembly: Syncfusion.EJ2.dll
    Syntax
    public class GridColumnBuilder<T> : ControlBuilder where T : class
    Type Parameters
    Name Description
    T

    Constructors

    GridColumnBuilder()

    Declaration
    public GridColumnBuilder()

    GridColumnBuilder(List<GridColumn>)

    Declaration
    public GridColumnBuilder(List<GridColumn> collection)
    Parameters
    Type Name Description
    System.Collections.Generic.List<GridColumn> collection

    Methods

    Add()

    Declaration
    public void Add()

    AllowEditing(Boolean)

    If allowEditing set to false, then it disables editing of a particular column. By default all columns are editable.

    Declaration
    public GridColumnBuilder<T> AllowEditing(bool allowEditing)
    Parameters
    Type Name Description
    System.Boolean allowEditing
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowFiltering(Boolean)

    If allowFiltering set to false, then it disables filtering option and filter bar element of a particular column. By default all columns are filterable.

    Declaration
    public GridColumnBuilder<T> AllowFiltering(bool allowFiltering)
    Parameters
    Type Name Description
    System.Boolean allowFiltering
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowGrouping(Boolean)

    If allowGrouping set to false, then it disables grouping of a particular column. By default all columns are groupable.

    Declaration
    public GridColumnBuilder<T> AllowGrouping(bool allowGrouping)
    Parameters
    Type Name Description
    System.Boolean allowGrouping
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowReordering(Boolean)

    If allowReordering set to false, then it disables reorder of a particular column. By default all columns can be reorder.

    Declaration
    public GridColumnBuilder<T> AllowReordering(bool allowReordering)
    Parameters
    Type Name Description
    System.Boolean allowReordering
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowResizing(Boolean)

    If allowResizing set to false, it disables resize option of a particular column.

    Declaration
    public GridColumnBuilder<T> AllowResizing(bool allowResizing)
    Parameters
    Type Name Description
    System.Boolean allowResizing
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowSearching(Boolean)

    If allowSearching set to false, then it disables Searching of a particular column. By default all columns allow Searching.

    Declaration
    public GridColumnBuilder<T> AllowSearching(bool allowSearching)
    Parameters
    Type Name Description
    System.Boolean allowSearching
    Returns
    Type Description
    GridColumnBuilder<T>

    AllowSorting(Boolean)

    If allowSorting set to false, then it disables sorting option of a particular column. By default all columns are sortable.

    Declaration
    public GridColumnBuilder<T> AllowSorting(bool allowSorting)
    Parameters
    Type Name Description
    System.Boolean allowSorting
    Returns
    Type Description
    GridColumnBuilder<T>

    AutoFit(Boolean)

    If autoFit set to true, then the particular column content width will be adjusted based on its content in the initial rendering itself. Setting this property as true is equivalent to calling autoFitColumns method in the dataBound event.

    Declaration
    public GridColumnBuilder<T> AutoFit(bool autoFit)
    Parameters
    Type Name Description
    System.Boolean autoFit
    Returns
    Type Description
    GridColumnBuilder<T>

    ClipMode(ClipMode)

    Defines the cell content's overflow mode. The available modes are Clip - Truncates the cell content when it overflows its area. Ellipsis - Displays ellipsis when the cell content overflows its area. EllipsisWithTooltip - Displays ellipsis when the cell content overflows its area also it will display tooltip while hover on ellipsis applied cell.

    Declaration
    public GridColumnBuilder<T> ClipMode(ClipMode clipMode)
    Parameters
    Type Name Description
    ClipMode clipMode
    Returns
    Type Description
    GridColumnBuilder<T>

    Columns(Object)

    Used to render multiple header rows(stacked headers) on the Grid header.

    Declaration
    public GridColumnBuilder<T> Columns(object columns)
    Parameters
    Type Name Description
    System.Object columns
    Returns
    Type Description
    GridColumnBuilder<T>

    Columns(String[])

    Used to render multiple header rows(stacked headers) on the Grid header.

    Declaration
    public GridColumnBuilder<T> Columns(string[] columns)
    Parameters
    Type Name Description
    System.String[] columns
    Returns
    Type Description
    GridColumnBuilder<T>

    Commands(Object)

    commands provides an option to display command buttons in every cell. The available built-in command buttons are Edit - Edit the record. Delete - Delete the record. Save - Save the record. Cancel - Cancel the edit state.

    Declaration
    public GridColumnBuilder<T> Commands(object commands)
    Parameters
    Type Name Description
    System.Object commands
    Returns
    Type Description
    GridColumnBuilder<T>

    CustomAttributes(Object)

    The CSS styles and attributes of the content cells of a particular column can be customized.

    Declaration
    public GridColumnBuilder<T> CustomAttributes(object customAttributes)
    Parameters
    Type Name Description
    System.Object customAttributes
    Returns
    Type Description
    GridColumnBuilder<T>

    DataSource(Action<DataManagerBuilder>)

    Declaration
    public GridColumnBuilder<T> DataSource(Action<DataManagerBuilder> dataSource)
    Parameters
    Type Name Description
    System.Action<DataManagerBuilder> dataSource
    Returns
    Type Description
    GridColumnBuilder<T>

    DataSource(Object)

    Defines the column data source which will act as foreign data source.

    Declaration
    public GridColumnBuilder<T> DataSource(object dataSource)
    Parameters
    Type Name Description
    System.Object dataSource
    Returns
    Type Description
    GridColumnBuilder<T>

    DefaultValue(Object)

    Defines default values for the component when adding a new record to the Grid.

    Declaration
    public GridColumnBuilder<T> DefaultValue(object defaultValue)
    Parameters
    Type Name Description
    System.Object defaultValue
    Returns
    Type Description
    GridColumnBuilder<T>

    DisableHtmlEncode(Boolean)

    If disableHtmlEncode is set to true, it encodes the HTML of the header and content cells.

    Declaration
    public GridColumnBuilder<T> DisableHtmlEncode(bool disableHtmlEncode)
    Parameters
    Type Name Description
    System.Boolean disableHtmlEncode
    Returns
    Type Description
    GridColumnBuilder<T>

    DisplayAsCheckBox(Boolean)

    If displayAsCheckBox is set to true, it displays the column value as a check box instead of Boolean value.

    Declaration
    public GridColumnBuilder<T> DisplayAsCheckBox(bool displayAsCheckBox)
    Parameters
    Type Name Description
    System.Boolean displayAsCheckBox
    Returns
    Type Description
    GridColumnBuilder<T>

    Edit(Object)

    Defines the IEditCell object to customize default edit cell.

    Declaration
    public GridColumnBuilder<T> Edit(object edit)
    Parameters
    Type Name Description
    System.Object edit
    Returns
    Type Description
    GridColumnBuilder<T>

    EditType(String)

    Defines the type of component for editing.

    Declaration
    public GridColumnBuilder<T> EditType(string editType)
    Parameters
    Type Name Description
    System.String editType
    Returns
    Type Description
    GridColumnBuilder<T>

    EnableGroupByFormat(Boolean)

    If enableGroupByFormat set to true, then it groups the particular column by formatted values. By default no columns are group by format.

    Declaration
    public GridColumnBuilder<T> EnableGroupByFormat(bool enableGroupByFormat)
    Parameters
    Type Name Description
    System.Boolean enableGroupByFormat
    Returns
    Type Description
    GridColumnBuilder<T>

    Field(String)

    Defines the field name of column which is mapped with mapping name of DataSource. The bounded columns can be sort, filter and group etc., If the field name contains “dot”, then it is considered as complex binding. The field name must be a valid JavaScript identifier, the first character must be an alphabet and should not contain spaces and special characters.

    Declaration
    public GridColumnBuilder<T> Field(string field)
    Parameters
    Type Name Description
    System.String field
    Returns
    Type Description
    GridColumnBuilder<T>

    Field<TProperty>(Expression<Func<T, TProperty>>)

    Declaration
    public GridColumnBuilder<T> Field<TProperty>(Expression<Func<T, TProperty>> field)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression<System.Func<T, TProperty>> field
    Returns
    Type Description
    GridColumnBuilder<T>
    Type Parameters
    Name Description
    TProperty

    Filter(Object)

    Defines the filter options to customize filtering for the particular column. @default null

    Declaration
    public GridColumnBuilder<T> Filter(object filter)
    Parameters
    Type Name Description
    System.Object filter
    Returns
    Type Description
    GridColumnBuilder<T>

    FilterBarTemplate(Object)

    The filterBarTemplate is used to add a custom component instead of default input component for filter bar. It have create and read functions. create: It is used for creating custom components. read: It is used to perform custom filter action.

    Declaration
    public GridColumnBuilder<T> FilterBarTemplate(object filterBarTemplate)
    Parameters
    Type Name Description
    System.Object filterBarTemplate
    Returns
    Type Description
    GridColumnBuilder<T>

    ForeignKeyField(String)

    Defines the mapping column name of the foreign data source. If it is not defined then the columns.field will be considered as mapping column name

    Declaration
    public GridColumnBuilder<T> ForeignKeyField(string foreignKeyField)
    Parameters
    Type Name Description
    System.String foreignKeyField
    Returns
    Type Description
    GridColumnBuilder<T>

    ForeignKeyValue(String)

    Defines the display column name from the foreign data source which will be obtained from comparing local and foreign data

    Declaration
    public GridColumnBuilder<T> ForeignKeyValue(string foreignKeyValue)
    Parameters
    Type Name Description
    System.String foreignKeyValue
    Returns
    Type Description
    GridColumnBuilder<T>

    Format(Object)

    It is used to change display value with the given format and does not affect the original data. Gets the format from the user which can be standard or custom number and date formats.

    Declaration
    public GridColumnBuilder<T> Format(object format)
    Parameters
    Type Name Description
    System.Object format
    Returns
    Type Description
    GridColumnBuilder<T>

    Format(String)

    It is used to change display value with the given format and does not affect the original data. Gets the format from the user which can be standard or custom number and date formats.

    Declaration
    public GridColumnBuilder<T> Format(string format)
    Parameters
    Type Name Description
    System.String format
    Returns
    Type Description
    GridColumnBuilder<T>

    Formatter(Object)

    Defines the method which is used to achieve custom formatting from an external function. This function triggers before rendering of each cell.

    Declaration
    public GridColumnBuilder<T> Formatter(object formatter)
    Parameters
    Type Name Description
    System.Object formatter
    Returns
    Type Description
    GridColumnBuilder<T>

    Freeze(FreezeDirection)

    Declaration
    public GridColumnBuilder<T> Freeze(FreezeDirection freeze)
    Parameters
    Type Name Description
    FreezeDirection freeze
    Returns
    Type Description
    GridColumnBuilder<T>

    HeaderTemplate(String)

    Defines the column template as string or HTML element ID which is used to add customized element in the column header.

    Declaration
    public GridColumnBuilder<T> HeaderTemplate(string headerTemplate)
    Parameters
    Type Name Description
    System.String headerTemplate
    Returns
    Type Description
    GridColumnBuilder<T>

    HeaderText(String)

    Defines the header text of column which is used to display in column header. If headerText is not defined, then field name value will be assigned to header text.

    Declaration
    public GridColumnBuilder<T> HeaderText(string headerText)
    Parameters
    Type Name Description
    System.String headerText
    Returns
    Type Description
    GridColumnBuilder<T>

    HeaderTextAlign(TextAlign)

    Define the alignment of column header which is used to align the text of column header.

    Declaration
    public GridColumnBuilder<T> HeaderTextAlign(TextAlign headerTextAlign)
    Parameters
    Type Name Description
    TextAlign headerTextAlign
    Returns
    Type Description
    GridColumnBuilder<T>

    HideAtMedia(String)

    column visibility can change based on its Media Queries. hideAtMedia accepts only valid Media Queries.

    Declaration
    public GridColumnBuilder<T> HideAtMedia(string hideAtMedia)
    Parameters
    Type Name Description
    System.String hideAtMedia
    Returns
    Type Description
    GridColumnBuilder<T>

    Index(Double)

    Gets the unique identifier value of the column. It is used to get the object.

    Declaration
    public GridColumnBuilder<T> Index(double index)
    Parameters
    Type Name Description
    System.Double index
    Returns
    Type Description
    GridColumnBuilder<T>

    IsFrozen(Boolean)

    You can use this property to freeze selected columns in grid.

    Declaration
    public GridColumnBuilder<T> IsFrozen(bool isFrozen)
    Parameters
    Type Name Description
    System.Boolean isFrozen
    Returns
    Type Description
    GridColumnBuilder<T>

    IsIdentity(Boolean)

    If isIdentity is set to true, then this column is considered as identity column.

    Declaration
    public GridColumnBuilder<T> IsIdentity(bool isIdentity)
    Parameters
    Type Name Description
    System.Boolean isIdentity
    Returns
    Type Description
    GridColumnBuilder<T>

    IsPrimaryKey(Boolean)

    If isPrimaryKey is set to true, considers this column as the primary key constraint.

    Declaration
    public GridColumnBuilder<T> IsPrimaryKey(bool isPrimaryKey)
    Parameters
    Type Name Description
    System.Boolean isPrimaryKey
    Returns
    Type Description
    GridColumnBuilder<T>

    LockColumn(Boolean)

    Defines the mapping column name of the foreign data source. If it is not defined then the columns.field will be considered as mapping column name

    Declaration
    public GridColumnBuilder<T> LockColumn(bool lockColumn)
    Parameters
    Type Name Description
    System.Boolean lockColumn
    Returns
    Type Description
    GridColumnBuilder<T>

    MaxWidth(Double)

    Defines the maximum width of the column in pixel or percentage, which will restrict resizing beyond this pixel or percentage.

    Declaration
    public GridColumnBuilder<T> MaxWidth(double maxWidth)
    Parameters
    Type Name Description
    System.Double maxWidth
    Returns
    Type Description
    GridColumnBuilder<T>

    MaxWidth(String)

    Defines the maximum width of the column in pixel or percentage, which will restrict resizing beyond this pixel or percentage.

    Declaration
    public GridColumnBuilder<T> MaxWidth(string maxWidth)
    Parameters
    Type Name Description
    System.String maxWidth
    Returns
    Type Description
    GridColumnBuilder<T>

    MinWidth(Double)

    Defines the minimum width of the column in pixels or percentage.

    Declaration
    public GridColumnBuilder<T> MinWidth(double minWidth)
    Parameters
    Type Name Description
    System.Double minWidth
    Returns
    Type Description
    GridColumnBuilder<T>

    MinWidth(String)

    Defines the minimum width of the column in pixels or percentage.

    Declaration
    public GridColumnBuilder<T> MinWidth(string minWidth)
    Parameters
    Type Name Description
    System.String minWidth
    Returns
    Type Description
    GridColumnBuilder<T>

    ShowColumnMenu(Boolean)

    If showColumnMenu set to false, then it disable the column menu of a particular column. By default column menu will show for all columns

    Declaration
    public GridColumnBuilder<T> ShowColumnMenu(bool showColumnMenu)
    Parameters
    Type Name Description
    System.Boolean showColumnMenu
    Returns
    Type Description
    GridColumnBuilder<T>

    ShowInColumnChooser(Boolean)

    If showInColumnChooser set to false, then hides the particular column in column chooser. By default all columns are displayed in column Chooser.

    Declaration
    public GridColumnBuilder<T> ShowInColumnChooser(bool showInColumnChooser)
    Parameters
    Type Name Description
    System.Boolean showInColumnChooser
    Returns
    Type Description
    GridColumnBuilder<T>

    SortComparer(Object)

    It defines the custom sort comparer function.

    Declaration
    public GridColumnBuilder<T> SortComparer(object sortComparer)
    Parameters
    Type Name Description
    System.Object sortComparer
    Returns
    Type Description
    GridColumnBuilder<T>

    SortComparer(String)

    It defines the custom sort comparer function.

    Declaration
    public GridColumnBuilder<T> SortComparer(string sortComparer)
    Parameters
    Type Name Description
    System.String sortComparer
    Returns
    Type Description
    GridColumnBuilder<T>

    Template(String)

    Defines the column template that renders customized element in each cell of the column. It accepts either template string or HTML element ID.

    Declaration
    public GridColumnBuilder<T> Template(string template)
    Parameters
    Type Name Description
    System.String template
    Returns
    Type Description
    GridColumnBuilder<T>

    TextAlign(TextAlign)

    Defines the alignment of the column in both header and content cells.

    Declaration
    public GridColumnBuilder<T> TextAlign(TextAlign textAlign)
    Parameters
    Type Name Description
    TextAlign textAlign
    Returns
    Type Description
    GridColumnBuilder<T>

    Type(String)

    Defines the data type of the column.

    Declaration
    public GridColumnBuilder<T> Type(string type)
    Parameters
    Type Name Description
    System.String type
    Returns
    Type Description
    GridColumnBuilder<T>

    Uid(String)

    Gets the unique identifier value of the column. It is used to get the object.

    Declaration
    public GridColumnBuilder<T> Uid(string uid)
    Parameters
    Type Name Description
    System.String uid
    Returns
    Type Description
    GridColumnBuilder<T>

    ValidationRules(Object)

    Defines rules to validate data before creating and updating.

    Declaration
    public GridColumnBuilder<T> ValidationRules(object validationRules)
    Parameters
    Type Name Description
    System.Object validationRules
    Returns
    Type Description
    GridColumnBuilder<T>

    ValueAccessor(Object)

    Defines the method used to apply custom cell values from external function and display this on each cell rendered.

    Declaration
    public GridColumnBuilder<T> ValueAccessor(object valueAccessor)
    Parameters
    Type Name Description
    System.Object valueAccessor
    Returns
    Type Description
    GridColumnBuilder<T>

    ValueAccessor(String)

    Defines the method used to apply custom cell values from external function and display this on each cell rendered.

    Declaration
    public GridColumnBuilder<T> ValueAccessor(string valueAccessor)
    Parameters
    Type Name Description
    System.String valueAccessor
    Returns
    Type Description
    GridColumnBuilder<T>

    Visible(Boolean)

    If visible is set to false, hides the particular column. By default, all columns are displayed.

    Declaration
    public GridColumnBuilder<T> Visible(bool visible)
    Parameters
    Type Name Description
    System.Boolean visible
    Returns
    Type Description
    GridColumnBuilder<T>

    Width(Double)

    Defines the width of the column in pixels or percentage.

    Declaration
    public GridColumnBuilder<T> Width(double width)
    Parameters
    Type Name Description
    System.Double width
    Returns
    Type Description
    GridColumnBuilder<T>

    Width(String)

    Defines the width of the column in pixels or percentage.

    Declaration
    public GridColumnBuilder<T> Width(string width)
    Parameters
    Type Name Description
    System.String width
    Returns
    Type Description
    GridColumnBuilder<T>
    Back to top Generated by DocFX
    Copyright © 2001 - 2023 Syncfusion Inc. All Rights Reserved