Our blazing fast Grid component built with pure JavaScript


Post by greg_make »

Do you have any suggestions for getting a dynamic drop downlist while typing in a text area.

I've been using Tribute js and while it mostly works fine,
however if you use the mouse to click on an item in the list, that ends my cell editing.

I dont suppose you have some suggestions

trib_js.png
trib_js.png (41.81 KiB) Viewed 99 times

Post by marcio »

Hey greg_make,

Thanks for reaching out.

You can try to achieve a dynamic dropdown list while typing in a text area within a grid cell by using the CellEdit feature to customize the editor. You can listen to the beforeCellEditStart event to replace the default editor with a custom one that integrates Tribute.js.

To prevent the cell editing from ending when clicking on an item in the dropdown, you can use the continueEditingOnCellClick config of the CellEdit feature. Set it to true to keep the editor open when interacting with elements inside the cell.

Here's a basic example:

grid.on('beforeCellEditStart', ({ editorContext }) => {
    // Replace the default editor with a custom one
    editorContext.editor = new TextArea({
        // Your custom configuration
    });
});

// Prevent cell editing from ending on click
grid.features.cellEdit.continueEditingOnCellClick = true;

This should help maintain the editing state when interacting with the dropdown list. If you need further customization, consider handling the startCellEdit event to initialize Tribute.js on the editor.

Best regards,
Márcio

How to ask for help? Please read our Support Policy


Post by greg_make »

It didn't prevent it, seems that blur will always finish the editing.
However I was able to modify the tribute js src to prevent it from losing focus, works great thanks.


Post Reply