Comments (7)
This is very tricky. We have two approaches according to my knowledge.
🚀 1. Create an array attribute and change it on addElement
, addBoards
, removeElement
and removeBoard
calls to keep it even with DOM.
or
🎉 2. Read jKanban DOM and output a JSON.
I would like to vote which you guys think it's better.
from jkanban.
i think approach 1. could have some potential inconsistency when the user could be frantically draging the boxes here and there.
therefore i consider approach 2 more trustworthy.
this could help
methods: {
renderJSON(){
const obj = this.$refs.demo2
let boards = []
obj.querySelectorAll('.kanban-board').forEach(el => {
let items = []
el.querySelectorAll('.kanban-item').forEach(i => {
items.push({
title: i.innerHTML,
})
})
boards.push({
id: el.getAttribute('data-id'),
title: el.querySelector('.kanban-title-board').innerHTML,
items,
})
})
return boards
}
},
from jkanban.
This is nice. I had to keep jKanban data in a var to save on database. Having a function to export kanban to json will make that simpler.
from jkanban.
Can I look into it?
from jkanban.
Can I look into it?
For sure. Pull requests are always welcome.
from jkanban.
I think this needs to be updated to return the name of the item not the HTML
methods: {
renderJSON(){
const obj = this.$refs.demo2
let boards = []
obj.querySelectorAll('.kanban-board').forEach(el => {
let items = []
el.querySelectorAll('.kanban-item').forEach(i => {
items.push({
title: i.childNodes[1].innerHTML,
})
})
boards.push({
id: el.getAttribute('data-id'),
title: el.querySelector('.kanban-title-board').innerHTML,
items,
})
})
return boards
}
},
from jkanban.
I hope it helps, with this I rather get the id's since with that I can get everything else from the database
function renderJSON() {
const obj = document.querySelector('#div_jkanban_id'); // EDIT YOUR DIV ID
let boards = [];
obj.querySelectorAll('.kanban-board').forEach(el => {
let items = [];
el.querySelectorAll('.kanban-item').forEach(i => {
items.push({
element_id: i.getAttribute('data-eid'),
})
})
boards.push({
board_id: el.getAttribute('data-id'),
items,
})
})
return JSON.stringify(boards);
}
from jkanban.
Related Issues (20)
- Struggeling between 2 versions HOT 2
- jkanbanInstance.options.boards not updated to match board state HOT 1
- HTML Content ?
- Item Sizing Problem after enable itemAddOptions
- is-moving class doesn't get removed on spill
- Can i get a callback whenever the user scrolled to the bottom of a board HOT 1
- Is there a method to refresh/reload the kanban items? HOT 4
- Is there any way to collapse kanban board? HOT 2
- Checkbox is not working on board HOT 21
- dropEl function for sorting boards HOT 4
- Uncaught TypeError: Cannot read properties of undefined (reading 'dragTo') HOT 1
- Header of kanban boards - adding a button HOT 5
- Footer button to add items on a specific board HOT 8
- HEX colors for boards headers HOT 2
- Browser context menu disabled - how to enable. HOT 1
- Which js minification software does jkanban use HOT 2
- can i add Kebab menu to kanban-item to i can drag item to anther id ??? HOT 2
- importing jkanban/dist/jkanban.min.js file throws an error HOT 4
- How to get item id when clicked HOT 1
- JKanban drag and move not working properly when we use the mobile view HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jkanban.