Hi,
I'm playing with v11.0p_2016-07-17/LGPL Deployment and have found a possible problem with menus.
I have a datasource that returns tree data as a child array and I want to bind this data to a MenuButton but had a problem - sub-menus were not appearing.
Upon closer inspection I see some code has been recently updated in Menu.initWidget:
and Menu.hasFlatDataSource is defined as:
Which means that unless there is a parent-linked relationship then a tree never gets created.
I think the correct behaviour would be to also consider the following condition in hasFlatDataSource:
For now, to fix my use case I've just overriden hasFlatDataSource() in my sub-class to return false and the menu is working.
I'm playing with v11.0p_2016-07-17/LGPL Deployment and have found a possible problem with menus.
I have a datasource that returns tree data as a child array and I want to bind this data to a MenuButton but had a problem - sub-menus were not appearing.
Upon closer inspection I see some code has been recently updated in Menu.initWidget:
Code:
if (this.dataSource != null && !this.hasFlatDataSource()) {
Code:
hasFlatDataSource : function () { var ds = isc.DataSource.get(this.dataSource); var names = ds.getFieldNames(); var hasPK = false, hasFK = false; for (var i=0; i < names.length; i++) { var fld = ds.getField(names[i]); if (fld.primaryKey) hasPK = true; if (fld.foreignKey) hasFK = true; } return !(hasPK && hasFK); }
I think the correct behaviour would be to also consider the following condition in hasFlatDataSource:
Code:
ds.childrenField != null || dataProperties.modelType == "children"
Comment