datepickk icon indicating copy to clipboard operation
datepickk copied to clipboard

Tooltips

Open bugToaster opened this issue 9 years ago • 4 comments

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

bugToaster avatar Oct 31 '16 06:10 bugToaster

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

bugToaster avatar Oct 31 '16 06:10 bugToaster

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

MrIsaacs avatar Mar 25 '18 02:03 MrIsaacs

Yeah , Different time hour / text

bugToaster avatar Mar 25 '18 02:03 bugToaster

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);

MrIsaacs avatar Mar 26 '18 23:03 MrIsaacs