Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Every boards duplicate in the board list given as parameter #45

Closed
Adioud opened this issue Feb 7, 2019 · 6 comments
Closed

Every boards duplicate in the board list given as parameter #45

Adioud opened this issue Feb 7, 2019 · 6 comments

Comments

@Adioud
Copy link

Adioud commented Feb 7, 2019

Hi !

We have to give a list of boards in order to create our jkanban.
I see that this list have 2x more elements after jkanban creation than before.

For instance, if I have 5 elements in the boardJson given as "boards" parameter, after creation of jkanban I have boardJson.lenght = 10.
This is not good for me because I need this list for other purpose. Duplicate boards are boring the handle.

Looking into the code, I see this " self.options.boards.push(board);" in the "addBoards" function.
As boards are already in options, I think that this is unusefull and the root of my trouble.

I comment this line, and everything "seems" to work fine without this line.

Can I have your opinion on this?

Thank you!

@marcosrocha85
Copy link
Contributor

I never saw that behavior. I have a client with 5 boards and a huge amount of 100+ items per board doing it's job with ajax requests at every interaction. Btw, I guess that is not a DOM problem, but just that boardJson property.

Just in time: I never used that property before. 😳

@mkooo
Copy link

mkooo commented Mar 15, 2019

Why do I get double the object data after creating jkanban?

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/riktar/jkanban/dist/jkanban.min.css">

</head>
<body>
<div id="myKanban"></div>

<script src="https://cdn.jsdelivr.net/gh/riktar/jkanban/dist/jkanban.min.js"></script>
<script>
  var defaultBoards = [
          { id: '1',title: 'task', item: [{id:'1-1',title:'add something1'}]},
          { id: '1',title: 'working', item: [{id:'1-1',title:'add something2'}]},
          { id: '1',title: 'done', item: [{id:'1-1',title:'add something3'}]}
      ];
  
  var KanbanTest = new jKanban({
      element: '#myKanban',
      gutter: '10px',
      widthBoard: '450px',
      boards: defaultBoards
  });

    console.log(defaultBoards);
</script>
</body>
</html>

The contents of [defaultBoards] are doubled.

@riktar
Copy link
Owner

riktar commented Mar 15, 2019

Hi @mkooo, all ids of the boards must be unique, in your code all the boards have id:'1'

@mkooo
Copy link

mkooo commented Mar 15, 2019

Hi, @riktar
Thank you for your comment.
I tried to fix the source code.
However, the problem could not be solved yet.

My object data is only 3 elements, but the result of [console.log] is 6 elements.

Sorry to trouble you, but could you give me some advice?

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title>Title</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/riktar/jkanban/dist/jkanban.min.css">

</head>
<body>
<div id="myKanban"></div>

<script src="https://cdn.jsdelivr.net/gh/riktar/jkanban/dist/jkanban.min.js"></script>
<script>
  var defaultBoards = [
          { id: '1',title: 'task', item: [{id:'1-1',title:'add something1'}]},
          { id: '2',title: 'working', item: [{id:'1-2',title:'add something2'}]},
          { id: '3',title: 'done', item: [{id:'1-3',title:'add something3'}]}
      ];
  
  var KanbanTest = new jKanban({
      element: '#myKanban',
      gutter: '10px',
      widthBoard: '450px',
      boards: defaultBoards
  });

    console.log(defaultBoards);
</script>
</body>
</html>

---- result of console.log ----

[{ id: '1',title: 'task', item: [{id:'1-1',title:'add something1'}]},
{ id: '2',title: 'working', item: [{id:'1-2',title:'add something2'}]},
{ id: '3',title: 'done', item: [{id:'1-3',title:'add something3'}]},
{ id: '1',title: 'task', item: [{id:'1-1',title:'add something1'}]},
{ id: '2',title: 'working', item: [{id:'1-2',title:'add something2'}]},
{ id: '3',title: 'done', item: [{id:'1-3',title:'add something3'}]}]

@riktar
Copy link
Owner

riktar commented Mar 15, 2019

@mkooo defaultBoards must be used only for configuration, if you want the boards or elemnet inside jKanban you must use the API https://github.com/riktar/jkanban#api

@riktar
Copy link
Owner

riktar commented Apr 30, 2019

fixed in 1d3f2bf

@riktar riktar closed this as completed Apr 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants