Skip to content
This repository has been archived by the owner on Sep 25, 2019. It is now read-only.

'children' of undefined #1

Closed
gazouweb opened this issue Sep 30, 2016 · 4 comments
Closed

'children' of undefined #1

gazouweb opened this issue Sep 30, 2016 · 4 comments

Comments

@gazouweb
Copy link

Hi,

I use datatables with ajax and server side, but when I click on expand, I get an error

Uncaught TypeError: Cannot read property 'children' of undefined

@homfen
Copy link
Owner

homfen commented Oct 3, 2016

Hi,
According to your description, I guess the data of the row you clicked is undefined, so I suggest you to check the data. You can also check my demo for the columns setting, the column 0 will handle the children property.

Good luck.
Homfen

@ensignwy
Copy link

ensignwy commented Apr 21, 2017

Hi,
I get the error too,"Cannot read property 'children' of undefined",the wrong line is in (dataTables.treeGrid.js:140),but I think my data is right,here is my data:

{
    "success": true,
    "code": "success",
    "message": "操作成功",
    "data": [
        {
            "children": [
                {
                    "leaf": true,
                    "code": "100001",
                    "grade": "1",
                    "id": 2,
                    "name": "公司领导",
                    "root": false,
                    "treePath": ",1,",
                    "type": "2"
                },
                {
                    "leaf": true,
                    "code": "100002",
                    "grade": "1",
                    "id": 3,
                    "name": "人力部",
                    "root": false,
                    "treePath": ",1,",
                    "type": "2"
                },
                {
                    "leaf": true,
                    "code": "100003",
                    "grade": "1",
                    "id": 4,
                    "name": "市场部",
                    "root": false,
                    "treePath": ",1,",
                    "type": "2"
                },
                {
                    "leaf": true,
                    "code": "100004",
                    "grade": "1",
                    "id": 5,
                    "name": "技术部",
                    "root": false,
                    "treePath": ",1,",
                    "type": "2"
                },
                {
                    "leaf": true,
                    "code": "100005",
                    "grade": "1",
                    "id": 6,
                    "name": "研发部",
                    "root": false,
                    "treePath": ",1,",
                    "type": "2"
                },
                {
                    "children": [
                        {
                            "leaf": true,
                            "code": "200001",
                            "grade": "2",
                            "id": 8,
                            "name": "公司领导",
                            "root": false,
                            "treePath": ",1,7,",
                            "type": "2"
                        },
                        {
                            "leaf": true,
                            "code": "200002",
                            "grade": "2",
                            "id": 9,
                            "name": "综合部",
                            "root": false,
                            "treePath": ",1,7,",
                            "type": "2"
                        }
                    ],
                    "leaf": false,
                    "code": "200000",
                    "grade": "2",
                    "id": 7,
                    "name": "山东省分公司",
                    "root": false,
                    "treePath": ",1,",
                    "type": "1"
                }
            ],
            "leaf": false,
            "code": "100000",
            "grade": "1",
            "id": 1,
            "name": "北京市总公司",
            "root": true,
            "treePath": ",",
            "type": "1"
        }
    ]
}

@ensignwy
Copy link

I resoved this problem,bacause my jquery.datatales.js version is 1.10.7 and yours is 1.10.13-dev,my version is too low,when I upgraded,the problem is gone

@simon1tan
Copy link

Please mark this as closed.

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

No branches or pull requests

4 participants