Our blazing fast Grid component built with pure JavaScript


Post by bensullivan »

Hi

We have a grid with two dropdown columns. Is there an easy way to add a custom validation so that certain combinations of dropdown values are not allowed and that styles the error message similar to a percent column:
Screen Shot 2019-10-22 at 19.15.25.png
Screen Shot 2019-10-22 at 19.15.25.png (31.24 KiB) Viewed 1659 times
Thanks

Ben

Post by sergey.maltsev »

Hi,

You should just provide available items for the dropdown column via items or store.
You may filter available items in beforeCellEditStart event or from any other place.

This is the default behavior.
Combo.png
Combo.png (25.25 KiB) Viewed 1656 times
You may check in this demo
https://www.bryntum.com/examples/grid/celledit/

Post by bensullivan »

Hi

The validation was more around ensuring that both dropdowns have a value selected before the grid is parsed and submitted to our API.

Is there a way to configure the grid/columns to do that with an error styled tooltip?

Thanks

Ben

Post by sergey.maltsev »

Hi!

To show error tip you could use tooltip with this config.
Provide record id and field name for grid.getCell() method
https://www.bryntum.com/docs/gantt/#Grid/view/Grid#function-getCell

const toolTip = new Tooltip({
    cls        : 'b-field-error-tip',
    align      : 'l-r',
    forElement : grid.getCell({ id : 1, field : 'name' }),
    html       : `Error in cell`
});
toolTip.show();

Post Reply