2.3.3. Custom columns
Overview
Custom columns allows you to define your own columns within the Gantt widget. This is helpful when you want to show more information within a glance of opening the widget. The value can be anything from a string, to an integer.
For an example see: custom columns
Implementation
Enabling custom columns requires a few steps:
Enable the custom columns feature by going to the features tab and setting "custom columns" to "yes".
Create a new non-persistable entity that extends TaskCrud. You should ad an attribute for every column that you need. The attribute type (String, Enumeration, etc.) must match the attribute type you will select in the next step (attribute on you task entity). The widget will then automatically map all changes to the CRUD entities so they can be used in the sync flow.
Create a new custom column in the columns tab.
Under CRUD Attribute name * you need to type in the corresponding name of the attribute you defined on your TaskCrud specialisation (in the example above this is TaskCrudExtended). This way Mendix will know to map the right values in the sync operation.
Type in a caption (this is what the column will be called).
Select the attribute on you task entity that contains the value of your custom column
Specify if the user can edit the value in the UI
Syncing custom column values
To sync the value of a custom column you will need to make a few modifications to your sync flow. Specifically you will want to cast the TaskCrud specialization to the previously your specialization created earlier to be able to access all the values of your CRUD object. In the example above this specialization is called TaskCrudExtended. After casting it the values of the custom columns will become available and can be used to modify the task in the database. For a more in depth example see our quick start application and specifically the microflow “TaskCrudExtended_Process_Advanced“.
Note that when using long values the widget is limited to a maximum value of 9007199254740991