iommirocks / iommi

Your first pick for a django power cord
http://iommi.rocks
BSD 3-Clause "New" or "Revised" License
804 stars 51 forks source link

WIP actions should be replaced on ajax #591

Open boxed opened 1 month ago

boxed commented 1 month ago

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

berycz commented 1 month ago

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