// Pass in a default page size. May be overridden by settings.
@Input() pageSize: number;
- // If true and an idlClass is specificed, the grid assumes
- // datatype=link fields that link to classes which define a selector
- // are fleshed with the linked object. And, instead of displaying
- // the raw field value, displays the selector value from the linked
- // object. The caller is responsible for fleshing the appropriate
- // fields in the GridDataSource getRows handler.
- //
- // This only applies to auto-generated columns.
- //
- // For example, idlClass="aou" and field="ou_type", the display
- // value will be ou_type().name() since "name" is the selector
- // field on the "aout" class.
@Input() showLinkSelectors: boolean;
@Input() disablePaging: boolean;
this.context.isMultiSortable = this.multiSortable === true;
this.context.useLocalSort = this.useLocalSort === true;
this.context.disableSelect = this.disableSelect === true;
- this.context.showLinkSelectors = this.showLinkSelectors === true;
this.context.disableMultiSelect = this.disableMultiSelect === true;
this.context.rowFlairIsEnabled = this.rowFlairIsEnabled === true;
this.context.showDeclaredFieldsOnly = this.showDeclaredFieldsOnly;
this.context.cellClassCallback =
this.cellClassCallback || function() { return ''; };
+ if (this.showLinkSelectors) {
+ console.debug(
+ 'showLinkSelectors is deprecated and no longer has any effect');
+ }
+
this.context.init();
}
let idlParent;
let idlField;
- let idlClass = this.idl.classes[this.idlClass];
+ let idlClass;
+ let nextIdlClass = this.idl.classes[this.idlClass];
const pathParts = dotpath.split(/\./);
for (let i = 0; i < pathParts.length; i++) {
+
const part = pathParts[i];
idlParent = idlField;
+ idlClass = nextIdlClass;
idlField = idlClass.field_map[part];
- if (idlField) {
- if (idlField['class'] && (
- idlField.datatype === 'link' ||
- idlField.datatype === 'org_unit')) {
- idlClass = this.idl.classes[idlField['class']];
- }
- } else {
- return null;
+ if (!idlField) { return null; } // invalid IDL path
+
+ if (i === pathParts.length - 1) {
+ // No more links to process.
+ break;
+ }
+
+ if (idlField['class'] && (
+ idlField.datatype === 'link' ||
+ idlField.datatype === 'org_unit')) {
+ // The link class on the current field refers to the
+ // class of the link destination, not the current field.
+ // Mark it for processing during the next iteration.
+ nextIdlClass = this.idl.classes[idlField['class']];
}
}
applyColumnDefaults(col: GridColumn) {
- if (!col.idlFieldDef && col.path) {
- const idlInfo = this.idlInfoFromDotpath(col.path);
+ if (!col.idlFieldDef) {
+ const idlInfo = this.idlInfoFromDotpath(col.path || col.name);
if (idlInfo) {
col.idlFieldDef = idlInfo.idlField;
col.idlClass = idlInfo.idlClass.name;
defaultVisibleFields: string[];
defaultHiddenFields: string[];
overflowCells: boolean;
- showLinkSelectors: boolean;
disablePaging: boolean;
showDeclaredFieldsOnly: boolean;
col.isIndex = (field.name === pkeyField);
col.isAuto = true;
- if (this.showLinkSelectors) {
- const selector = this.idl.getLinkSelector(
- this.columnSet.idlClass, field.name);
- if (selector) {
- col.path = field.name + '.' + selector;
- }
- }
-
if (this.showDeclaredFieldsOnly) {
col.hidden = true;
}