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

WIP actions should be replaced on ajax #591

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boxed
Copy link
Collaborator

@boxed boxed commented Oct 24, 2024

After a discussion on Discord: the actions needs to be reloaded to get filters included in CSV download button.

Bery: hmm, you'll probably need data-iommi-id-of-table like the filter has, so you know which actions to replace

@@ -213,6 +211,10 @@ class IommiBase {
const element = document.createRange().createContextualFragment(html);
container.appendChild(element);

let actions_container = container.parentElement.querySelector('.iommi-actions');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think

const actions_container = document.querySelector(`.iommi-actions[data-iommi-id-of-table="${container.getAttribute('data-iommi-id')}"]`);

@berycz
Copy link
Contributor

berycz commented Oct 24, 2024

I have one more idea about this
the endpoints__tbody__func would be defined outside the Table, so people can do

class MyTable:
    class Meta:
        @staticmethod
        def endpoints__tbody__func(table, **kwargs):
            r = iommi_default_table_endpoints__tbody__func(table, **kwargs)
            r["foo"] = table.extra_evaluated.foo
            return r

and then in the JS we could add the response to the dispatch of iommi.element.populated event (or make another event for that)

that way the tbody can return more custom stuff... lets say some extra_evaluated that you have outside of container, but may depend on filter/paginator. E.g. number of filtered objects somewhere in the h1, or any data for charts or whatever

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