GraffitiGridColumn

Enumerations #

NameValues
WidthTypesPixels
Percentage

Constants #

NameTypeValue
  This class exposes no constants.

Events #

DefinitionDescription
 This class does not expose any events.

Methods #

DefinitionDescription
Constructor( colID as String, colTitle as String )Creates an instance of this class with the parameters as property values.

Properties #

NameTypeDefault ValueDescription
ContextMenuGraffitiMenuItemNilEnables the automatic display of already configured and added GraffitiMenuItems instances without a round-trip to the server
DecimalPlacesMaxInteger4Applies only to columns with FormatType and EditType = Double or Currency.
DecimalPlacesMinInteger0Applies only to columns with FormatType and EditType = Double or Currency.
EditorGraffitiWebGrid.EditTypesNoneDetermines the editor type to be used. See EditTypes Enumeration of GraffitiWebGrid.
EditorButtonCaptionString“”Caption to display in the button of the EditTypes.TextWithButton editor. Supports FontAwesome icons in the format <fas fa-search>
EditorButtonIndicatorWebUIControl.IndicatorsDefaultBootstrap indicator to apply to the button of an editor that possesses one.
EditorButtonTooltipString“”Tooltip to display when the user hovers their mouse over the button of an editor that possesses one.
EditorFieldReadOnlyBooleanFalseWhen True and column is of type EditTypes.TextWithButton, the text field will be read only.
FocusableBooleanTrueDetermines whether this column’s cells will accept focus.
FormatterGraffitiWebGrid.FormatTypesTextDetermines how the values for this column are formatted for display.
FormatterJavaScriptString“”JavaScript function used to format cell values when Formatter = FormatTypes.JavaScript.
GroupGraffitiGridColumnGroupNilColumn group in which to include this column.
HeaderButtonCaptionString“”Supplying anything other than an empty string for this property will display a button in the column’s header.
HeaderButtonIndicatorWebUIContro.IndicatorsDefaultBootstrap indicator applied to the header button.
HeaderButtonTooltipString“”Tooltip for the header button.
HeaderStyleWebStyleNilOverrides the default style and the StyleHeader property of the containing Grid.
IDString“”The identifier for the column’s values. Values should be alphanumeric with no special characters such as underscore(_) or hyphen(-), and are case-sensitive. This should not be changed outside the Constructor. Spaces are also disallowed. Should not contain only a number or start with a number.
IntegerValueMaxInteger100Maximum value allowed in the Integer editor.
IntegerValueMinInteger0Minimum value allowed in the Integer editor. Negative numbers are supported.
MaxWidthInteger0The maximum width this column can have within the display.
MinWidthInteger0The minimum width this column can have within the display.
NativeCheckboxDisabledBooleanFalseWhen True, all checkboxes in the column will be disabled to prevent user’s changing the value.
PercentScaleGraffitiGridPercentScaleNilGraffitiGridPercentScale object that is applied to cell values when using FormatTypes.Percentage.
PopupMenuAllowEmptyBooleanFalseWhen True, the PopupMenu editor must have a valid selection.
PopupMenuPlaceholderString“”The placeholder text for the PopupMenu editor.
PopupMenuSearchThresholdInteger0Determines how many values must be present in order to display the search bar within the cell’s PopupMenu.
PopupMenuValuesString()Empty ArrayPossible values for the user to select in the PopupMenu editor.
ProgressAnimatedBooleanFalseWhen True, the Progress formatter will animated its value. Note that this will have no effect if ProgressStriped = False.
ProgressStripedBooleanFalseWhen True, the progress value will have stripes drawn across its face.
ResizeableBooleanFalseDetermines whether this column can be resized.
SelectableBooleanFalseDetermines whether this column can be selected by clicking the header.
SortableBooleanTrueDetermines whether the user can sort the rows by clicking this column’s header.
SortDirection ReadOnlyGraffitiWebGrid.SortDirectionsNoneReturns the current sort direction value.
SorterString“”JavaScript sort method to use for sorting grid rows by column data.
StyleWebStyleNilStyle applied to row cells in this column. Overrides everything except for style specified by AddCellStyle.
TagVariantNilUse for storing things like your database field key. This value has no functional application beyond being used for your reference.
TitleString“”The displayed title for the column in the header.
TooltipString“”The tip text displayed when the mouse hovers over the column header.
VisibleBooleanTrueThe current visible state of the column.
WidthInteger0The width for the column.
WidthTypeWidthTypesPixelsDetermines whether the Width property will be interpreted as a pixel value or a percentage.
ZeroValueOverrideString“”String to display when Double or Currency cell values are equal to 0.0. Leave empty to display actual value.

Examples #

Styling #

To style the header, you can make use of GraffitiStyles to achieve the desired effect. To center text in the column header, you can use the following:

  var gridColumnCenter as GraffitiStyle = GraffitiStyle.Create( Session, "gridColumnCenter", "text-align:center;justify-content:center" )
  myColumn.HeaderStyle = gridColumnCenter

To style all of the row cells in a column, you can assign the gridColumnCenter object as defined above to the Style property of the column:

  myColumn.Style = gridColumnCenter

One important note is that row cells use flexbox. This means that you’ll need to use the justify-content CSS attribute to center text, and other changes may need flexbox-specific attributes.

To right-align text in cells, you’ll need to use the flex-end value of the justify-content CSS attribute, like so:

  var gridColumnRight as GraffitiStyle = GraffitiStyle.Create( Session, "gridColumnRight", "text-align:right;justify-content:flex-end" )

Sorter Method #

The Sorter property allows implementation of a custom JavaScript sort function that is executed client-side. Note that errors in the JavaScript code supplied may cause Grid instances to fail to load or behave erratically. Below is an example of a functional JavaScript sort function for sorting integers, and is used within GraffitiGrid:

  function(direction, columnId, firstRow, secondRow) {
 
    '// direction is the integer direction of the sort. -1 for descending, 1 for ascending.
    '   columnId is the string column ID that is being sorted.
    '   firstRow is the JavaScript object containing the data for the first row in the comparison.
    '   secondRow is JavaScript object containing the data for the second row in the comparison.
 
    var x = (isNaN(firstRow[columnId]) || firstRow[columnId] === '' || firstRow[columnId] === null) ? -99e+10 : parseFloat(firstRow[columnId]);
    var y = (isNaN(secondRow[columnId]) || secondRow[columnId] === '' || secondRow[columnId] === null) ? -99e+10 : parseFloat(secondRow[columnId]);
    return direction * (x === y ? 0 : (x > y ? 1 : -1));
  }

You would store this in a string constant or variable and assign it to your GraffitiGridColumn’s Sorter property.