diff --git a/data/alasql/anyTable.js b/data/alasql/anyTable.js index 783e630..ee30eb4 100644 --- a/data/alasql/anyTable.js +++ b/data/alasql/anyTable.js @@ -613,9 +613,11 @@ anyTable.prototype.dbSearchItemLists = async function(id,grouping,groupId) anyTable.prototype.dbSearchItemListOfType = async function(id,linkType,grouping,groupId) { let link_tablename = this.findLinkTableName(linkType); - if (this.tableExists(link_tablename)) { + if (this.tableExists(link_tablename) && (id || id === 0)) { let factory = new anyTableFactory(this.connection); - let link_classname = this.linkTypes[linkType].className; + let link_classname = this.linkTypes && this.linkTypes[linkType] + ? this.linkTypes[linkType].className + : null; let table = await factory.createClass(link_classname,{type:linkType, header:true, path:this.path}); //console.log("created class "+link_classname); if (table && (table.type != this.type || this.hasParentId())) { diff --git a/data/mysql/anyTable.php b/data/mysql/anyTable.php index 702e85f..f1fe75c 100644 --- a/data/mysql/anyTable.php +++ b/data/mysql/anyTable.php @@ -776,7 +776,7 @@ protected function dbSearchItemLists($id=null,$grouping=false,$groupId=null) protected function dbSearchItemListOfType($id,$linkType,$grouping=false,$groupId=null) { $link_tablename = $this->findLinkTableName($linkType); - if ($this->tableExists($link_tablename)) { + if ($this->tableExists($link_tablename) && ($id || $id === 0)) { $table = anyTableFactory::createClass($linkType,$this); //elog("created class ".$linkType); if ($table && ($table->mType != $this->mType || $this->hasParentId())) {