GithubHelp home page GithubHelp logo

Comments (3)

neuronetio avatar neuronetio commented on June 12, 2024

You can click on an item, take the X position of the mouse and calculate what percentage of the item's width it is.
For example when you click at the end of an item you will get something like 100% and at the beginning you will get something like 0%.
Knowing what percentage of an item is clicked, you will know if progress was clicked - because progress is also a percentage.
You can even give yourself a margin of error like 10px or 10% - so you don't need to click perfectly on the pixel.

from gantt-schedule-timeline-calendar.

neuronetio avatar neuronetio commented on June 12, 2024

You can use slots to add click event on the item.
slots documentation

NOT TESTED EXAMPLE CODE:

function myItemSlot(vido, props) {
  const { onChange } = vido;

  function onClick() {
    alert(props.item.id + " clicked!");
  }

  onChange((changedProps) => {
    // if current element is reused to display other item data just update your data so when you click you will display right alert
    props = changedProps;
  });

  // return render function
  return (content) =>
    vido.html`<div class="my-item-wrapper" @click=${onClick}>${content}</div>`;
}

const config = {
/* ... */
slots: {
    'chart-timeline-items-row-item': { inner: [myItemSlot] },
  },
/* ... */
};

from gantt-schedule-timeline-calendar.

rohith5429 avatar rohith5429 commented on June 12, 2024

Thank you!!. Your solution worked perfectly!.

from gantt-schedule-timeline-calendar.

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.