Last Updated: February 25, 2016
·
257
· nicocrm

InforCRM custom grid format column

You can specify a format function in the Application Architect:

Picture

The function will receive parameter data (the value that correspond to the data field specified in the column definition), row index, and a reference to the cell object. Note that the function won't be invoked when the data is null.

A common case is when the format function needs to make use of several fields in the row. This can be achieved by retrieving the data from the grid's data store, using the row index provided:

var item = cell.grid.getItem(rowIndex);
var value = cell.grid.store.getValue(item, "FieldName");

Here is an example that will return the contact's name if there is one, and fall back to the CreateUser's name:

function (userId, rowIndex, cell) {
    var item = cell.grid.getItem(rowIndex);
    var contact = cell.grid.store.getValue(item, "Contact");
    if (contact) {
        return contact.FullName;
    } else {
        return userId ? Sage.Utility.getUserName(userId) : "";
    }
}

If the new field name is not already in the grid remember to add it to the select list in Application Architect.