Page tree

You are viewing documentation for Structure Server and Data Center version 5.5 and patch releases. For other versions, see Version Index or Structure Cloud.

Skip to end of metadata
Go to start of metadata


A subclass of Column class represents column objects of a specific type.Columns need to be subclassed for a particular column type implementation. You can override methods while subclassing to modify the default behavior.


var api = window.almworks.structure.api;
var MyColumn = api.subClass('MyColumn', api.Column, {
  init: function() {
  getCellViewHtml: function() {
    return '<div> ... </div>';



Contains context information about where the column is used. See The Column Context for more information.


Contains column specification object. Specification object is serialized as a part of the overall view specification and stored on the server and in the browser's local storage. See Column Specifications for more information.



Initializer method.


Returns HTML that is displayed in the grid cell for a specific issue. The HTML should contain the value provided by this column. Structure will also wrap the value in decorative elements – this could be overridden by providing getCellViewHtml() method.



returns current row's attribute value


returns current row's id

renderingParameters.getItemId()return current row's item id


var Template = require('almworks/util/Template');
var cellTemplate = new Template('<span class="acme-field">{awesomefield}</span>');
getCellValueHtml: function(rp) {
  return cellTemplate.renderHtml({ awesomefield: rp.getAttributeFieldValue({id: 'com.acme.awesome-data', format: 'text'}) });


Returns customized HTML that is displayed in the grid cell for a specific issue. By default, calls getCellValueHtml() and wraps the retrieved value into the default Structure style. Can be overridden to allow higher degree of control over the cell appearance.



returns current row's attribute value


returns current row's id

renderingParameters.getItemId()return current row's item id


Lets column request attributes that are needed for rendering. The attributes are provided on the server side by AttributeLoaderProvider.



Method for collecting required attributes.

Parameters are:

  • attributeSpec is the attribute specification object
  • forestSpec is the forest specification for the forest, from which attribute should be loaded (optional)

About Attribute Specs

AttributeSpec defines the attribute and format to be loaded. See Loading Attribute Values for more information on attributes.

Some of the attributes are shown below. You can also define your own attribute, calculate it on the server side and request from your column.

About Forest Spec

Forest specification is optional. When used, it allows you to get attribute value from a different forest – however, it must be related to the forest being displayed, otherwise it will not have the same rows.

For example, you can specify a forest specification with some transformation to display values from there in the untransformed forest. There are also two special values for forestSpec:

  • 'displayed' is the default value, meaning "use the forest that is being displayed"
  • 'unfiltered' means "use the same forest, but remove all filters that are coming at the end of transformation chain"


collectRequiredAttributes: function(attributeSet) {
  attributeSet.requireAttribute({id: 'key', format: 'text'});
    id: 'sum', 
    format: 'number',
    params: {
      id: 'customfield',
      format: 'number',
      params: {
        fieldId: 10010
  }, 'unfiltered');
  attributeSet.requireAttribute({id: '', format: 'json'});

Some of the attributes provided by Structure:

Attribute Spec




{id: <jira-field-id>, format: 'html'}



The HTML representation of a JIRA issue field value, as seen on the issue page or in the Issue Navigator. Structure allows non-issue items also have these values.

<jira-field-id> is the common name for the JIRA's standard field id.

This attribute does not load custom fields.

{id: 'customfield', format: 'html', params: { fieldId: <field-numeric-id> }} HTML representation of a custom field value.
{id: 'project', format: 'id'}



Project ID for the issues. The id format means either a string or a number, depending on what is being used for identifying the object.


{id: 'editable', format: 'boolean'}


Boolean value telling whether the item can be edited by the user.


See also CoreAttributeSpecs for examples of bundled attributes.



Must return default column name, assigned when user adds column of specified type to the structure view. Returns empty string by default.


getDefaultName: function() { return 'My Column'; }


Returns whether the column is resizable or not. Returns true by default.


isResizable: function() { return false; }


Returns whether column can shrink beyond minimum size if there's not enough space on the screen. Returns false by default.


canShrinkWhenNoSpace: function() { return true; }


Returns if the column should be auto-resized to fit its contents. Returns false by default.


isAutoSizeAllowed: function() { return true; }


Returns minimum width of the column in pixels. Returns 27 by default.


getMinWidth: function() { return 100; }


Returns default width of the column in pixels. Returns 120 by default.


getDefaultWidth: function() { return 100; }


Returns HTML that will be used in the grid header. By default returns cell with column name in default Structure style.


getHeaderCellHtml: function() { return '<div>' + + '</div>'; }


Returns a JavaScript object specifying the metadata needed by this column to render the values. See Requesting and Using Metadata for more information. By default returns null, which means that no metadata is needed.


getMetadataRequests: function() {
  return {
    status: {
      url: baseUrl + '/rest/api/2/status',
      cacheable: true


Returns attribute specification for sorting when the user clicks on the header. If null is returned (the default), the clicking this column header does not result in added sorting transformation.


If returns true the initial direction of the sorting will be descending.

  • No labels