Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add "before" events #384

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Conversation

breakone
Copy link
Contributor

@breakone breakone commented Jun 3, 2024

emit some events before the actual action happens

@johanneswilm
Copy link
Member

@breakone Thanks. Very interesting addition. I wonder if we also should add something to allow for canceling the handling of the event. Something like the event.preventDefault() for the beforeinput event. It would require changes to the emit() method. I am not sure how that would be implemented in the best possible way without breaking too much yet .

How are you using this event?

@breakone
Copy link
Contributor Author

breakone commented Jun 3, 2024

I built myself a "details row". Therefor I added a column and used the render method to render all the detail information into a new column:

...
{
                select: 9,
                sortable: false,
                cellClass: 'd-none certificate-database__extra-info',
                headerClass: 'd-none',
                render: (data, td, rowIndex, cellIndex) => {
                    const document = this.renderField(this.certDbPersonalTable, rowIndex, 3);
                    const competency = this.renderField(this.certDbPersonalTable, rowIndex, 4);
                    return document + competency;
                }
            },
...

on datatable.selectrow I use this column to add a new row (tr) beneath the selected one. I copied the contents of the column into my new "details row".

but on page change, I need to remove the extra rows before the action happens.

@johanneswilm johanneswilm merged commit ec0f752 into fiduswriter:main Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants