Our state of the art Gantt chart


Post by ahmed.farahat »

Hi,

We have a situation where we have a custom column class and we want to pass some external meta data from outside the gantt to the column renderer function is there anyway to do this

for example

<BryntumGantt
	    config={config}
            columns={columns}
            project={projectModel}
            ref={ganttRef}
            metaData="some meta info here"
          />

Then in the Column class like below we want to access this info

export default class BudgetKwColumn extends Column {
  static get type() {
    return 'budgetkw';
  }

  field = 'budgetkw';

  text = gettext('Budget/kW');

  htmlEncode = false;

  autoWidth = true;

  readOnly = true;

  editor = false;

  type = 'number';
  renderer(renderData) {
    // access this infor here
  }
}

is there a way to do this, or something similar that allow us to pass info to the column renderer


Post by alex.l »

There is a `grid property in renderData https://bryntum.com/products/gantt/docs/api/Grid/column/Column#config-renderer
that has a Gantt instance. It should help you to pass extra data.

  renderer(renderData) {
    // access this infor here
    const ganttInstance = renderData.grid;
  }

All the best,
Alex


Post by ahmed.farahat »

thanks, i know there is a grid instance in the renderer function but how can i pass information to that grid instance, if i put any extra prop in the react component as shown in the code above it doesnt come in the grid instance in the function

for example

console.log(renderData.grid,metaData)

is undefined, because probably your grid instance doesnt include any props that are not really part of the grid config, so my question was is there any specific property in the grid instance that i can use to pass this extra data


Post by mats »

You could simply assign your extra property to the grid and then access that via the grid..?


Post by ahmed.farahat »

Thanks, this worked


Post Reply