fix TypeError for numeric _id

This commit is contained in:
ralf 2024-06-07 11:55:33 +02:00
parent e0d4a9fce8
commit 9974b35420

View File

@ -966,13 +966,17 @@ export class Et2Tree extends Et2WidgetWithSelectMixin(LitElement)
* @return {TreeItemData} node with the given _id or null * @return {TreeItemData} node with the given _id or null
* @private * @private
*/ */
private _search(_id: string, data: TreeItemData[]): TreeItemData private _search(_id: string|number, data: TreeItemData[]): TreeItemData
{ {
let res: TreeItemData = null let res: TreeItemData = null
if (_id == undefined) if (_id == undefined)
{ {
return null return null
} }
if (typeof _id === "number")
{
_id = _id + "";
}
for (const value of data) for (const value of data)
{ {
if (value.id === _id) if (value.id === _id)