stickshift.js
function mapColumns(children, callback) {
  var newChildren = [];
  React.Children.forEach(children, function(originalChild)  {
    var newChild = originalChild;

    // The child is either a column group or a column. If it is a column group
    // we need to iterate over its columns and then potentially generate a
    // new column group
    if (originalChild.type === FixedDataTableColumnGroup.type) {
      var haveColumnsChanged = false;
      var newColumns = [];

      forEachColumn(originalChild.props.children, function(originalcolumn)  {
        var newColumn = callback(originalcolumn);
        if (newColumn !== originalcolumn) {
          haveColumnsChanged = true;
        }
        newColumns.push(newColumn);
      });

      // If the column groups columns have changed clone the group and supply
      // new children
      if (haveColumnsChanged) {
        newChild = cloneWithProps(originalChild, {children: newColumns});
      }
    } else if (originalChild.type === FixedDataTableColumn.type) {
      newChild = callback(originalChild);
    }

    newChildren.push(newChild);
  });

  return newChildren;
}
function mapColumns(children, callback) {
  var newChildren = [];
  React.Children.forEach(children, function(originalChild)  {
    var newChild = originalChild;

    // The child is either a column group or a column. If it is a column group
    // we need to iterate over its columns and then potentially generate a
    // new column group
    if (originalChild.type === FixedDataTableColumnGroup.type) {
      var haveColumnsChanged = false;
      var newColumns = [];

      forEachColumn(originalChild.props.children, function(originalcolumn)  {
        var newColumn = callback(originalcolumn);
        if (newColumn !== originalcolumn) {
          haveColumnsChanged = true;
        }
        newColumns.push(newColumn);
      });

      // If the column groups columns have changed clone the group and supply
      // new children
      if (haveColumnsChanged) {
        newChild = cloneWithProps(originalChild, {children: newColumns});
      }
    } else if (originalChild.type === FixedDataTableColumn.type) {
      newChild = callback(originalChild);
    }

    newChildren.push(newChild);
  });

  return newChildren;
}
function mapColumns ( children , callback ) { var newChildren = [ ] ; React . Children . forEach ( children , function ( originalChild ) { var newChild = originalChild ; // The child is either a column group or a column. If it is a column group // we need to iterate over its columns and then potentially generate a // new column group if ( originalChild . type === FixedDataTableColumnGroup . type ) { var haveColumnsChanged = false ; var newColumns = [ ] ; forEachColumn ( originalChild . props . children , function ( originalcolumn ) { var newColumn = callback ( originalcolumn ) ; if ( newColumn !== originalcolumn ) { haveColumnsChanged = true ; } newColumns . push ( newColumn ) ; } ) ; // If the column groups columns have changed clone the group and supply // new children if ( haveColumnsChanged ) { newChild = cloneWithProps ( originalChild , { children : newColumns } ) ; } } else if ( originalChild . type === FixedDataTableColumn . type ) { newChild = callback ( originalChild ) ; } newChildren . push ( newChild ) ; } ) ; return newChildren ; }
Helper method to map columns to new columns. This takes into account column
groups and will generate a new column group if its columns change.
@param {?object|array} children
Children of a table.
@param {function} callback
Function to excecute for each column. It is passed the column and should
return a result column.
Helper method to map columns to new columns . This takes into account column groups and will generate a new column group if its columns change .