Litepicker icon indicating copy to clipboard operation
Litepicker copied to clipboard

Litepicker 1.x unique identifier for multiple instances

Open Saltibarsciai opened this issue 3 years ago • 1 comments

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

When page has multiple litepicker instances in dom root body they all have the same class: "litepicker" so I can't set position fixed for header datepicker and other additional styles for others

Describe the solution you'd like A clear and concise description of what you want to happen.

Either add trigger element class name with some prefix like "litepicker litepicker-USED-TRIGGER"

Or add method setId() which when used like this.picker.setId(uuidv4()) would add to the dom id like "litepicker-CUSTOM-UUID"

Or add method 'customClass()' which when used like this.picker.customClass(uuidv4()) would add to the dom class like "litepicker-CUSTOM-UUID"

Or add new param like new Litepicker({ domId: uuidv4() }) which would add to the dom id like "litepicker-CUSTOM-UUID"

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

now I'm in thinking period since I know this will be done not soon or will not be done. When I'll figure out something I'll share (or is there a solution for that already?)

Screenshot_24

If you think this is needed I can check package and add solution PR

Saltibarsciai avatar Mar 27 '21 16:03 Saltibarsciai

For v2

[].forEach.call(document.querySelectorAll('.lite-picker'), function (el, i, a) {
  lpicker = new Litepicker({
    element: el
  });
  lpicker.ui.setAttribute('id', `litepicker-${i}`)
});

hihahihahoho avatar Mar 30 '21 02:03 hihahihahoho