I always fail when I use tree drag, and the console prints a lot of errors.
After tracing analysis, it is found that this is an error caused by a special configuration.
The original error code is as follows:
$ (' #tree '). Tree ({
//omit other
loadfilter:function (data, parent) {return
data.rows;
}
});
Since my background return value is not a direct fit for tree use, you need to remove rows from it so that you have this code.
The reason for the Easyui error is that when you drag, the Loadfilter method is still invoked in the drag method, as shown in the following figure code:
Easyui in the previous processing, data has been processed for arrays, so when the Loadfilter method is invoked, Because the returned data.rows is definitely undefined rather than an array, there will be a subsequent error in the data operation, causing the drag to fail, and the entire tree is having problems.
The solution is also simple, changing the Loadfilter method to fit the default:
Loadfilter:function (data, parent) {
if ($.isarray (data)) {return
data;
}
return data.rows;
}
The main thing is to judge if data is a number of groups to return directly, otherwise return to my own data.rows.
The above is a small set to introduce the jquery Easyui tree using drag and drop encountered errors summary, hope to help everyone, if you have any questions please give me a message, small series will promptly reply to everyone. Here also thank you very much for the cloud Habitat Community website support!