Closed berycz closed 1 year ago
iommi.js
// TODO should this be somehow conditioned? so people can create their own extended instance?
I'd like to hear your opinion, I think it might be good for an inherited class
maybe by a "global" variable, or a data attribute on <html>
, or something
events iommi.init.start
and iommi.init.end
arent exactly "inits", or they are, but not constructor-init, they are on DOMContentLoaded
inits
if you have any better name, fire away
notice // deprecated, also it doesn't make sense to start spinner here imo
I have no idea why spinner should be there ?
I made two js classes - IommiBase
and IommiSelect2
instance of the first one is in window.iommi
, second as window.iommi.select2
I made all old functions deprecated, but left them there. If someone calls them, they get console.warn(...)
custom events
iommi.init.start
before functions/dependencies are being bound on elements
iommi.init.end
after -||-
iommi.error
when error occurs (only ajax errors for now, e.g. someone got logged out and receives html 403 instead of json, or when they're offline), good for popping up error messages to the user, triggered on any related elements, but probably better to listen on document
iommi.element.populated
- (for now only) table got loaded on filtering or paginating or reloaded, triggered on container; e.g. I use that for an "export csv" link, which I have above container and I want it to take in account filters
iommi.loading.start
- ajax loading started - good for showing spinners, triggered on container, or form for filter-form ajax validation
iommi.loading.end
- ajax loading ended - good for hiding spinners, triggered on the same element
element objects of filter form and table container get now iommi
object with specific functions/attributes
useful may be container.iommi.reload()
, e.g. if user was afk for a long time and you want to reload the table, or based on websocket messages, or anything
ad 10) iommi_validate_form throwing JS errors on field errors (fields)
you can test it if you have a select in a filter form: you change option value in the debugger and then select that option, you get now html5 validation error on the select
IommiBase.addLiveEventListener
is kinda like simple version of live $(selector).on()
in jquery, I didnt want to be dependent on jquery
file-inputs in filter-forms are as "todo" for now, I hardly think anybody will need it anytime soon
I got rid of axios
and used fetch
instead, with AbortController
per container/form, not global
I switched from snake_case to camelCase for variables and function names
MAIN NEWS pagination is via ajax now
this fixes https://github.com/iommirocks/iommi/issues/418