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

Treegrid Problem #1849

Closed
marifnst opened this issue Jul 21, 2019 · 3 comments · Fixed by #1898
Closed

Treegrid Problem #1849

marifnst opened this issue Jul 21, 2019 · 3 comments · Fixed by #1898

Comments

@marifnst
Copy link

marifnst commented Jul 21, 2019

Hi

i can't generate treegrid more than 2 level child, is there any suggestion regarding this problem ?

below is my console log error:
ERROR TypeError: toCheck.push is not iterable (cannot read property Symbol(Symbol.iterator))
at NbTreeGridService.find (index.js:21523)
at NbTreeGridService.toggle (index.js:21509)
at NbTreeGridDataSource.toggle (index.js:21579)
at NbTreeGridDataSource.toggleByIndex (index.js:21585)
at NbTreeGridComponent.toggleRow (index.js:22011)
at SafeSubscriber._next (index.js:21698)
at SafeSubscriber.__tryOrUnsub (Subscriber.js:183)
at SafeSubscriber.next (Subscriber.js:122)
at Subscriber._next (Subscriber.js:72)
at Subscriber.next (Subscriber.js:49)

fyi, i'm using ngx-admin.

it's happening also in ngx-admin website:
Screenshot from 2019-07-23 16-58-42

Thanks

@rahulaparajit79
Copy link

rahulaparajit79 commented Aug 27, 2019

I have also got same error. Please Fix it asap.
I have clone nebular repo and build run. There it is not having any issue, it is taking multiple levels.

I found the issue location ::
It is in NbTreeGridService class in find(data: NbTreeGridPresentationNode[], row: T) methos.
toCheck.push(...node.children);

@rahulaparajit79
Copy link

Got Solution
Give empty children array if a node has no children. As children is undefined toCheck.push(undefind) generate exception.
Give data in below format.

data: TreeNode[] = [
{
data: { name: 'A', kind: 'dir', size: '1', items: 2 },
children: [{
data: { name: 'A1', kind: 'dir', size: '1' },
children: [{
data: { name: 'A2', kind: 'dir', size: '1' },
children: [{
data: { name: 'A21', kind: 'dir', size: '1' },
children: [{
data: { name: 'A211', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A212', kind: 'doc', size: '1' },
children: [],
}],
}],
}, {
data: { name: 'A3', kind: 'dir', size: '1' },
children: [{
data: { name: 'A31', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A32', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A33', kind: 'doc', size: '1' },
children: [],
}],
},
{
data: { name: 'A4', kind: 'dir', size: '1' },
children: [{
data: { name: 'A41', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A42', kind: 'doc', size: '1' },
children: [],
}],
}],
},
],
},
];

@shacojx
Copy link

shacojx commented Aug 29, 2019

Got Solution
Give empty children array if a node has no children. As children is undefined toCheck.push(undefind) generate exception.
Give data in below format.

data: TreeNode[] = [
{
data: { name: 'A', kind: 'dir', size: '1', items: 2 },
children: [{
data: { name: 'A1', kind: 'dir', size: '1' },
children: [{
data: { name: 'A2', kind: 'dir', size: '1' },
children: [{
data: { name: 'A21', kind: 'dir', size: '1' },
children: [{
data: { name: 'A211', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A212', kind: 'doc', size: '1' },
children: [],
}],
}],
}, {
data: { name: 'A3', kind: 'dir', size: '1' },
children: [{
data: { name: 'A31', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A32', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A33', kind: 'doc', size: '1' },
children: [],
}],
},
{
data: { name: 'A4', kind: 'dir', size: '1' },
children: [{
data: { name: 'A41', kind: 'doc', size: '1' },
children: [],
},
{
data: { name: 'A42', kind: 'doc', size: '1' },
children: [],
}],
}],
},
],
},
];

thanks for solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants