Premium support for our pure JavaScript UI components


Post by ogardnerffdc »

Hi Bryntum team,

I'm building a custom currency column that extends NumberColumn. I am setting the currency via the https://bryntum.com/products/grid/docs/api/Grid/column/NumberColumn#config-format config.

I have a requirement to alter the currency in the cell editor dynamically based on a record. Is this possible in the current API? If it is, are you able to suggest how I can achieve this behaviour please?

Thanks!


Post by marcio »

Hey ogardnerffdc,

Thanks for reaching out.

Yes, you can change the editor per cell by setting the editor in beforeCellEditStart. In that handler you can return a new NumberField (or an editor config) with a currency-specific format based on the record.

Example:

grid.on('beforeCellEditStart', ({ editorContext }) => {
    const { record, column } = editorContext;

if (column.type === 'number' && column.field === 'amount') {
    // assign an editor config (or create a NumberField instance)
    editorContext.editor = {
        type   : 'number',
        format : { style : 'currency', currency : record.currency || 'USD' }
    };
}
});

Please take a look at beforeCellEditStart documentation for reference.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by ogardnerffdc »

It works a treat! Thanks Marcio!


Post by gbrdhvndi »

Hi Marcio,

We might have discovered a bug: when editing a currency value, if even a single character is removed from the currency code in the input field, the value is reset to 0. Removing the currency code completely, however, does not affect the value (which is expected).

Aleksei


Post by marcio »

Hey,

I tried to reproduce on our demo and don't see the behavior.

Could you please confirm that I'm trying correctly?

Attachments
Screen Recording 2025-11-07 at 18.00.09.mov
(4.88 MiB) Downloaded 12 times

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by gbrdhvndi »

Hey Marcio, in your demo you were editing the value, not the currency code.

I've attached a demo of the column we have created.

Screen Recording 2025-11-08 at 12.57.15.mov
(9.24 MiB) Downloaded 14 times

Aleksei


Post by marcio »

Hey,

Thanks for sharing the video.

I created a ticket to fix that. Please follow the updates here.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post Reply