Our pure JavaScript Scheduler component


Post by thomasb »

Hi

Sometimes we have names with three words or a abbrevation with 3 character. Is it possible two show here instead of only two character --> three character? without using the renderer function, because then I have to do all the logic with the image, name, event count by myself?!

Image

I hope you know what I mean.


Post by alex.l »

Hi,

Not out of the box. You need to extend ResourceModel and override getter for initials field to make that possible.

Here is original code:

    /**
     * Returns the initials (first letter of the first & last space-separated word in the name) or an empty string
     * if this resource has no name. You can override this method in a ResourceModel subclass to provide your own implementation
     *
     * @property {String}
     * @readonly
     * @category Common
     */
    get initials() {
        const
            { name = '' } = this;

    if (!name) {
        return '';
    }

    const names         = name.split(' '),
        firstInitial  = names[0][0],
        lastInitial   = (names.length > 1 ? names[names.length - 1][0] : '');

    return firstInitial + lastInitial;
}

All the best,
Alex


Post Reply