Our blazing fast Grid component built with pure JavaScript


Post by thomasb »

Hello,

I'm using a button widget in a column:

{
              width: 50,
              type: 'widget',
              align: 'center',
              enableHeaderContextMenu: false,
              widgets: [
                {
                  type: 'button',
                  cls: 'fa fa-check-circle-o',
                  style: 'border: none; background: transparent; font-size: 18px; -webkit-font-smoothing: antialiased; text-transform: lowercase; color: #000; min-width: 0; padding: 0;',
                  onClick: ({ source }) => {
                    const resourceId = source.cellInfo.record.id;
                    const date = source.cellInfo.record.date;
                    eventBusService.send({ action: 'editShift', date, resourceId });
                  }
                }
              ]
            }

I would like to condition the display of the button based on a record property.
Is it possible?

Thanks


Post by tasnim »

Hi,

You can achieve it through https://bryntum.com/products/gantt/docs/api/Grid/column/WidgetColumn#config-afterRenderCell

afterRenderCell({ record, widgets }) {
                 // Hide checkboxes in certain rows
                 widgets[0].hidden = record.readOnly;
             }

Here is a codepen demo for you https://codepen.io/dv-auntik/pen/yLmgorZ?editors=0010

Best regards,
Tasnim

How to ask for help? Please read our Support Policy


Post by thomasb »

Thanks, it was helpful


Post Reply