collection.isChildOf
function, since version 1.0.0
categories: hierarchy
collection.isChildOf(childId, parentId)
This function can be used on hierarchical collections only (ie Category). Function return true, if record with childId
ID is descendant (or equal to) of record with parentId
. This function is very usefull for filtering hierarchical records. For example to select all subcategories of given category.
parameters
- childId: number - primary key of children record
- right: string - primary key of parent record
return type:
boolean
examples
category.isChildOf(12, 7)
category.isChildOf(category.id, 7)
category.isChildOf(product.defaultCategoryId, 7)