Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tooltips #6

Open
bugToaster opened this issue Oct 31, 2016 · 4 comments
Open

Tooltips #6

bugToaster opened this issue Oct 31, 2016 · 4 comments

Comments

@bugToaster
Copy link

tooltips function does not working for multiple option. It just for single date.

@bugToaster
Copy link
Author

By this tooltip possible to describe event number or something. So in this purpose need multiple tool-tips

@MrIsaacs
Copy link

MrIsaacs commented Mar 25, 2018

you mean multiple entries in one cell, in other words for one day?

@bugToaster
Copy link
Author

Yeah , Different time hour / text

@MrIsaacs
Copy link

MrIsaacs commented Mar 26, 2018

I needed it for an importer some days ago and came up with this:

function import(data) {
    var tmpCal = [];
    var tooltips = [];

    // for all your calender events
    for (let i = 1; i < data.length; i++) {
        [date, client, description] = getEntry(data, i);

        // if no order exist make an entry on that date
        if (!(date in tmpCal)) {
            tmpCal[date] = `${client}: ${description}`;
        }
        // if an order already exist append the next on that date
        else {
            tmpCal[date] += `<br>${client}: ${description}`;
        }

        tooltips.push({
            date: new Date(date),
            text: tmpCal[date]
        });
    }

    datepicker.tooltips = tooltips;
}

function getEntry(data, i) {
    return [
        data[i][1][0][3],  // date 
        data[i][1][10][3], // client
        data[i][1][5][3]  // description
    ];
}

It's not the cleanest solution, but serves as a workaround. What you do with getEntry is up to you. I use date as a YYYY-MM-DD string for indicating a day entry in the temporary calender and then append on that entry if an entry exists.
You can add time to the returned value of getEntry and change the template literals in import to your needs. When you do so you need to adjust your matched array to something like the following:

[date, time, client, description] = getEntry(data, i);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants