Skip to content

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

const element = document.createRange().createContextualFragment(html);
container.appendChild(element);

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

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
Collaborator

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.

3 participants