ParamQuery grid support forum

General Category => Help for ParamQuery Grid (free version) => Topic started by: hyh888 on September 27, 2023, 06:00:48 am

Title: bug in treegrid
Post by: hyh888 on September 27, 2023, 06:00:48 am
When the pid of the top root node in treegrid is 0( for the database in my company required that pid field couldn't be null.), the treegrid couldn't be show out.
When I tried modify the response data which come from server, it wil make a lot of trouble in select box in treegrid.
Is there any way to fix the bug?
Title: Re: bug in treegrid
Post by: paramvir on December 21, 2023, 11:29:29 am
root node is suppoed to have undefined pid.

0 is not the same as undefined so it's not a bug,
Title: Re: bug in treegrid
Post by: hyh888 on February 27, 2024, 02:39:18 pm
I have to make a patch like this to solve two in-build problem of tree.

        function getChanges(grid) {

            let list =grid.getChanges({ format: 'byVal' });

            list.addList.forEach(item => {
                delete item.id;
                if(!item.pid)item.pid=0;
            });
            list.updateList.forEach(item => {
                 delete item.items;
                if(!item.pid)item.pid=0;
            });

            return list;
        }