Our blazing fast Grid component built with pure JavaScript


Post by Webethics »

Any functionality or method to make the column header(column name) editable?

(please find the attachment for reference)

Attachments
Projects _ Largo.png
Projects _ Largo.png (44.75 KiB) Viewed 417 times
Last edited by Webethics on Wed Aug 24, 2022 9:01 am, edited 1 time in total.

Post by mats »

Seems like a reasonable feature request, opened one here: https://github.com/bryntum/support/issues/5112

Shouldn't be too hard to implement. If you want to take a stab at it yourself, you can look at https://bryntum.com/docs/scheduler/api/Core/widget/Editor along with a TextField.


Post by Webethics »

I tried but failed to make the column editable, could you please help me more regarding that?


Post by mats »

Here's a quick and dirty POC which works, you can refactor it as you like:

Add editName option to the https://bryntum.com/docs/scheduler/api/Grid/feature/HeaderMenu feature.

             *   features         : {
             *       headerMenu : {
             *           processItems({ column, items }) {
             *               // Add or hide existing items here as needed
             *               items.myAction = {
             *                   text   : 'Cool action',
             *                   icon   : 'b-fa b-fa-fw b-fa-ban',
             *                   onItem : () => console.log('Some coolness'),
             *                   weight : 300 // Move to end
             *               };
             *
             *               // Hide column picker
             *               items.columnPicker.hidden = true;
             *           }
             *       }
             *   },
             *
editName : {
                weight : 220,
                icon   : 'b-fw-icon b-icon-edit',
                text   : 'Rename',
                onItem : () => {
                    const textEl = this.client.getSubGridFromColumn(column).header.getHeader(column.id).querySelector('.b-grid-header-text');
                    this.editor = new Editor({
                        inputField : { type : 'text' },
                        owner      : this.client,
                        align      : {
                            align : 't0-t0'
                        }
                    });
                    this.editor.render(textEl);

                this.editor.startEdit({
                    target : textEl,
                    record : column,
                    field  : 'text'
                });
            }
        };
Attachments
coledit.mov
(841.81 KiB) Downloaded 49 times

Post Reply