riktar / jkanban

Vanilla Javascript plugin for manage kanban boards
https://www.riccardotartaglia.it/jkanban/
Apache License 2.0
1.09k stars 299 forks source link

Add class in items #43

Closed cmparrela closed 5 years ago

cmparrela commented 5 years ago

It would be nice if were possible to add class to items like already have in boards

cmparrela commented 5 years ago

I made a modification to use in my projeto, i added in line 258 next comment //create item

if (itemKanban.class != '' && itemKanban != undefined) {
    nodeItem.classList.add(itemKanban.class);
}

It's a very simple and very functional making the library more flexible for us

marcosrocha85 commented 5 years ago

Hello @cmparrela, in a project of mine I set cover image by jQuery. I think css for an item would be handy. I can do a pull request for that. Thank you for your suggestion.

adryx92 commented 5 years ago

I also made a modification to add items with specific classes in addElement function:

this.addElement = function(boardID, element, className) {
    //...
    if (className)
        nodeItem.classList.add(className);
    //...
}
Mikeproove commented 5 years ago

Hi Guys

Is there any update on this ?

And if it's already implemented, how do I set the class of an item from the start ?

Cheers Mike

riktar commented 5 years ago

@Mikeproove @cmparrela Now is possible to add custom classes to an item.

{
                "id"    : "item-id-1",        // id of the item
                "title" : "Item 1"            // title of the item
                "class" : ["myClass",...]     // array of additional classes
}

https://github.com/riktar/jkanban/commit/e3fa10ad69133e4b29fa6c5183c185631b90617c