Giter VIP home page Giter VIP logo

Comments (3)

allestaire avatar allestaire commented on May 30, 2024 2

One way to listen to value changes is to exntend its class and add your functionality
This code demonstrate on how to trigger onSelect option. so that everytime a new date is selected, it will be trigger

import Datepicker from 'flowbite-datepicker/Datepicker'

class FlowbiteDatepicker extends Datepicker {
  constructor(element, options = {}, rangepicker = undefined) {
    super(element, options, rangepicker)
    this.options = options
  }

  setDate(...args) {
    super.setDate(args);
    if (this.options.hasOwnProperty('onSelect')) {
      this.options.onSelect(this)
    }
  }
}

export default FlowbiteDatepicker

// Usage
new FlowbiteDatepicker(element, {
   onSelect(instant) {
      // Triggered when date is selected
      console.log(instant)
   }
})

from flowbite-datepicker.

jokerlovescaptainmarvel avatar jokerlovescaptainmarvel commented on May 30, 2024

Any help?

from flowbite-datepicker.

allestaire avatar allestaire commented on May 30, 2024

Dude, there documentation is not good,
Which is we are on the same boat.
They dont have an event for onSelect, it must be with the input

I guess they did this on purpose, in order to make us do upgrade.

It seems like there is a method for the Javascript instance

if you instanciate the picket with javascript instead of element
you will get the data

const dp = new DatePicket(element, {})
dp.getDate()

from flowbite-datepicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.