Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Vanilla Javascript plugin for manage kanban boards

License

NotificationsYou must be signed in to change notification settings

riktar/jkanban

Repository files navigation

Javascript plugin for Kanban boards

jKanban allow you to create and manage Kanban Board in your project!

Please try out the livedemo!

Install

Clone the repo and use the javascript and the css files in thedist folder.

You have to include

<link rel="stylesheet" href="path/to/jkanban.min.css">

and

<script src="path/to/jkanban.min.js"></script>

in your page and you are done.

Usage

Init jKanban is a piece of cake!

var kanban = new jKanban(options)

Here's anoverview of the default values.

varkanban=newjKanban({element          :'',// selector of the kanban containergutter           :'15px',// gutter of the boardwidthBoard       :'250px',// width of the boardresponsivePercentage:false,// if it is true I use percentage in the width of the boards and it is not necessary gutter and widthBoarddragItems        :true,// if false, all items are not draggableboards           :[],// json of boardsdragBoards       :true,// the boards are draggable, if false only item can be draggeditemAddOptions:{enabled:false,// add a button to board for easy item creationcontent:'+',// text or html content of the board buttonclass:'kanban-title-button btn btn-default btn-xs',// default class of the buttonfooter:false// position the button on footer},itemHandleOptions:{enabled             :false,// if board item handle is enabled or nothandleClass         :"item_handle",// css class for your custom item handlecustomCssHandler    :"drag_handler",// when customHandler is undefined, jKanban will use this property to set main handler classcustomCssIconHandler:"drag_handler_icon",// when customHandler is undefined, jKanban will use this property to set main icon handler class. If you want, you can use font icon libraries herecustomHandler       :"<span class='item_handle'>+</span> %title% "// your entirely customized handler. Use %title% to position item title// any key's value included in item collection can be replaced with %key%},click            :function(el){},// callback when any board's item are clickedcontext          :function(el,event){},// callback when any board's item are right clickeddragEl           :function(el,source){},// callback when any board's item are draggeddragendEl        :function(el){},// callback when any board's item stop dragdropEl           :function(el,target,source,sibling){},// callback when any board's item drop in a boarddragBoard        :function(el,source){},// callback when any board stop dragdragendBoard     :function(el){},// callback when any board stop dragbuttonClick      :function(el,boardId){},// callback when the board's button is clickedpropagationHandlers:[],// the specified callback does not cancel the browser event. possible values: "click", "context"})

Now take a look to theboards object

[{"id"    :"board-id-1",// id of the board"title" :"Board Title",// title of the board"class" :"class1,class2,...",// css classes to add at the title"dragTo":['another-board-id',...],// array of ids of boards where items can be dropped (default: [])"item"  :[// item of this board{"id"    :"item-id-1",// id of the item"title" :"Item 1"// title of the item"class" :["myClass",...]// array of additional classes},{"id"    :"item-id-2","title" :"Item 2"}]},{"id"    :"board-id-2","title" :"Board Title 2"}]

WARNING: all ids are unique!

About custom properties

jKanban also support custom properties on items to improve your applications with html data- properties. You can define them at like:

[{"id"    :"board-id-1","title" :"Board Title","item"  :[{"id"      :"item-id-1","title"   :"Item 1","username":"username1"},{"id"      :"item-id-2","title"   :"Item 2","username":"username2"}]}]

Which jKanban will convert to:

<mainclass="kanban-drag"><divclass="kanban-item"data-eid="item-id-1"data-username="username1">Item 1</div><divclass="kanban-item"data-eid="item-id-2"data-username="username2">Item 2</div></main>

API

jKanban provides the easiest possible API to make your boards awesome!

Method NameArgumentsDescription
addElementboardID, element, positionAddelement in the board with IDboardID,element is the standard format. Ifposition is set, inserts at position starting from 0
addFormboardID, formItemAddformItem as html element into the board with IDboardID
addBoardsboardsAdd one or more boards in the kanban,boards are in the standard format
findElementidFind board's item byid
replaceElementid, elementReplace item byid withelement JSON standard format
getParentBoardIDidGet board ID of itemid passed
findBoardidFind board byid
getBoardElementsidGet all item of a board
removeElementidRemove a board's element by id
removeBoardidRemove a board by id

Example

Clone the repo and look in theexample folder

Thanks

jKanban usedragula for drag&drop

Develop

Clone the repo then usenpm install for download all the dependencies then launchnpm run build for build the project

Pull Requests?

I'd love them!

Comments?

Let's hear them! (The nice ones please!)

Me?

In case you're interested I'm@riktarweb


[8]ページ先頭

©2009-2025 Movatter.jp