<@doc hierarchy="GMLDOM"> The alvConfig class hold the WebDynpro ALV tabel configuration. (c) SAP AG 2003-2006. All rights reserved. /////////////////////////////////////////////////////////////////////// // CLASS HEADER Class ALVConfig inherit gml2:Element; /////////////////////////////////////////////////////////////////////// // PROPERTIES // All Attribute has side affect to support the standard behavior of the story board that each attribute is black until it was set and then it becomes blue <@doc>Controls the visibility of the print button in the toolbar and the Print Version Tab in the settings dialog property printTableAllowed = false; metadata for printTableAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_PRINT]', descr: '#TEXT[XTOL_WD_ALV_PRINT_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('printTableAllowed',value); data.printTableAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data,def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('printTableAllowed')) data.printTableAllowed = data.runtimeConfig.printTableAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.printTableAllowed}, sideEffects: true, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the export button in the toolbar property exportAllowed = false; metadata for exportAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_EXPORT]', descr: '#TEXT[XTOL_WD_ALV_EXPORT_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('exportAllowed',value); data.exportAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('exportAllowed')) data.exportAllowed = data.runtimeConfig.exportAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.exportAllowed }, sideEffects: true, group: 'ALV', priority: 110 } } <@doc> Controls the visibility of filter toolbar icon in the the ALV table property filterAllowed = true; metadata for filterAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_FILTER]', descr: '#TEXT[XTOL_WD_ALV_FILTER_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('filterAllowed',value); data.filterAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('filterAllowed')) data.filterAllowed = data.runtimeConfig.filterAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.filterAllowed}, sideEffects: true, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the settings toolbar icon property settingsAllowed = true; metadata for settingsAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_SETTINGS]', descr: '#TEXT[XTOL_WD_ALV_SETTINGS_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('settingsAllowed',value); data.settingsAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue if(!value){ data.runtimeConfig.setProperty('columnSelectionAllowed',value); data.runtimeConfig.setProperty('sortAllowed',value); data.runtimeConfig.setProperty('personalizationAllowed',value); data.runtimeConfig.setProperty('aggregationsAllowed',value) } }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('settingsAllowed')) data.settingsAllowed = data.runtimeConfig.settingsAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.settingsAllowed }, sideEffects: true, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the column selection tab in the setting dialog property columnSelectionAllowed = true; metadata for columnSelectionAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_COLSELECT]', descr: '#TEXT[XTOL_WD_ALV_COLSELECT_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('columnSelectionAllowed',value); data.columnSelectionAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('columnSelectionAllowed')) data.columnSelectionAllowed = data.runtimeConfig.columnSelectionAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.columnSelectionAllowed }, active: function(value, data, def) {return value.runtimeConfig.settingsAllowed?true:false }, sideEffects: true, outer: 1, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the sorting tab in the settings dialog property sortAllowed = true; metadata for sortAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_SORT]', descr: '#TEXT[XTOL_WD_ALV_SORT_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('sortAllowed',value); data.sortAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('sortAllowed')) data.sortAllowed = data.runtimeConfig.sortAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.sortAllowed }, active: function(value, data, def) {return value.runtimeConfig.settingsAllowed?true:false}, outer: 1, sideEffects: true, group: 'ALV', priority: 110 } } <@doc> Controls the visibility of the aggregation tab in the settings dialog of the ALV table property aggregationsAllowed = true; metadata for aggregationsAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_CALC]', descr: '#TEXT[XTOL_WD_ALV_CALC_DESCR]', setter: function (value, data, def) { data.runtimeConfig.setProperty('aggregationsAllowed',value); if (value){ data.runtimeConfig.setProperty('groupingTableAllowed',!value); data.runtimeConfig.setProperty('groupCol'); } data.aggregationsAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('aggregationsAllowed')) data.aggregationsAllowed = data.runtimeConfig.aggregationsAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.aggregationsAllowed }, active: function(value, data, def) {return value.runtimeConfig.settingsAllowed?true:false}, outer: 1, sideEffects: true, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the views selection drop down in the toolbar. property personalizationAllowed = false; metadata for personalizationAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_PERSONALIZATION]', descr: '#TEXT[XTOL_WD_ALV_PERSONALIZATION_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('personalizationAllowed',value); data.personalizationAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('personalizationAllowed')) data.personalizationAllowed = data.runtimeConfig.personalizationAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.personalizationAllowed }, active: function(value, data, def) {return value.runtimeConfig.settingsAllowed?true:false }, sideEffects: true, outer: 1, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the grouping tab in the settings dialog and Group by Drop down in the toolbar. property groupingTableAllowed = false; metadata for groupingTableAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_GROUP]', descr: '#TEXT[XTOL_WD_ALV_GROUP_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('groupingTableAllowed',value); if (!value) data.runtimeConfig.setProperty('groupCol'); else if (value) { data.runtimeConfig.setProperty('aggregationsAllowed',!value); data.runtimeConfig.setProperty('graphicsAllowed',!value); data.runtimeConfig.setProperty('aggregationRules'); } data.groupingTableAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('groupingTableAllowed')) data.groupingTableAllowed = data.runtimeConfig.groupingTableAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.groupingTableAllowed }, sideEffects: true, group: 'ALV', priority: 110 } } <@doc> The group by column id property groupCol = ^gml2:Control; metadata for groupCol = { editor: { type: 'combo', label: '#TEXT[XFLD_WD_ALV_GROUPBY]', descr: '#TEXT[XTOL_WD_ALV_GROUPBY_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('groupCol',$ENV.contextUnit.getElement(value)); data.groupCol = $ENV.contextUnit.getElement(value);// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('groupCol')) data.groupCol = data.runtimeConfig.groupCol; // this features is hung on a grid view for the smart form use - - to color it in blue var col = data.runtimeConfig.groupCol; if (!col) return; return col.label || col.name; }, domain: function(value, data, def){ var helper = $ENV.datahlpr; var domain = []; var cols = value.controls; for ( var c in cols){ var col = cols[c]; domain.push({value: col.id, text: col.label || col.name}); } return domain}, active: function(data, def) { if (ISA(data, 'gml2:GridView')) return data.runtimeConfig.groupingTableAllowed ? true : false; if (ISA(data, '#NS[ALVConfig]')) return data.groupingTableAllowed ? true : false; return false; }, contentEditable: false, sideEffects: true, group: 'ALV', priority: 110 } } <@doc>Controls the visibility of the display type drop down in the toolbar property graphicsAllowed = false; metadata for graphicsAllowed = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_GRAPHIC]', descr: '#TEXT[XTOL_WD_ALV_GRAPHIC_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('graphicsAllowed',value); if (value){ data.runtimeConfig.setProperty('groupingTableAllowed',!value); data.runtimeConfig.setProperty('groupCol');} data.graphicsAllowed = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('graphicsAllowed')) data.graphicsAllowed = data.runtimeConfig.graphicsAllowed; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.graphicsAllowed }, group: 'ALV', sideEffects: true, priority: 110 } } <@doc>Controls the position aggregation row property AggregationBeforeItems = false; metadata for AggregationBeforeItems = { editor: { type: 'check', label: '#TEXT[XCKL_WD_ALV_CALCPOS]', descr: '#TEXT[XTOL_WD_ALV_CALCPOS_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('AggregationBeforeItems',value); data.AggregationBeforeItems = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('AggregationBeforeItems')) data.AggregationBeforeItems = data.runtimeConfig.AggregationBeforeItems; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.AggregationBeforeItems }, sideEffects: true, group: 'ALV', priority: 110 } } property scrollableColumns = 0; metadata for scrollableColumns = { editor : { type: 'int', label: '#TEXT[XFLD_WD_ALV_SCROLLCOL]', descr: '#TEXT[XTOL_WD_ALV_SCROLLCOL_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('scrollableColumns',value); data.scrollableColumns = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('scrollableColumns')) data.scrollableColumns = data.runtimeConfig.scrollableColumns; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.scrollableColumns }, sideEffects: true, group: 'ALV', min : 0, max : Math.pow(2, 31) - 1, priority: 110 } } property fixedColumns = 0; metadata for fixedColumns = { editor : { type: 'int', label: '#TEXT[XFLD_WD_ALV_FIXEDCOL]', descr: '#TEXT[XTOL_WD_ALV_FIXEDCOL_DESCR]', setter: function(value, data, def) { data.runtimeConfig.setProperty('fixedColumns',value); data.fixedColumns = value;// this attribute is hung on a grid view for the smart form use - to color it in blue }, getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } if(this.runtimeConfig && this.runtimeConfig.hasOwnProperty('fixedColumns')) data.fixedColumns = data.runtimeConfig.fixedColumns; // this features is hung on a grid view for the smart form use - - to color it in blue return data.runtimeConfig.fixedColumns }, sideEffects: true, group: 'ALV', min : 0, max : Math.pow(2, 31) - 1, priority: 110 } } <@doc>sorted column ids collection strong property sortRules = ^#NS[SortRule][id]; metadata for sortRules = { editor: { type: 'user', readonly: true, label: '#TEXT[XFLD_WD_ALV_INITSORT]', descr: '#TEXT[XTOL_WD_ALV_INITSORT_DESCR]', popup: '#URL[tools.editors.ConfigSortCols.htm]', params: function(value, data, def) {return {object:value} }, //visible: 'ISSUP("core.gml2:Interactor", "pagbar")', getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } var cols = ''; var sortOptions = ['#TEXT[XLST_DOM_SORTOP_UP]','#TEXT[XLST_DOM_SORTOP_DOWN]']; for(var a in data.runtimeConfig.sortRules){ var sort = data.runtimeConfig.sortRules[a]; var col = sort.colId; if (!col) return; var columnName = col.label || col.name; cols += columnName + '('+ sortOptions[INT(sort.sortOrder)-1] + ')' + ';';} return cols;}, setter: function(value, data, def) { if (!value) data.runtimeConfig.setProperty('sortRules'); }, group: 'initALV', priority: 110 } } <@doc>aggregation column ids collection strong property aggregationRules = ^#NS[AggregationRule][id]; metadata for aggregationRules = { editor: { type: 'user', readonly: true, label: '#TEXT[XFLD_WD_ALV_INITCALC]', descr: '#TEXT[XTOL_WD_ALV_INITCALC_DESCR]', popup: '#URL[tools.editors.ConfigCalcCols.htm]', //visible: 'ISSUP("core.gml2:Interactor", "pagbar")', getter: function(data, def) { if (!data.runtimeConfig){ var runtimeConfig = $ENV.contextUnit.createElement('#NS[ALVConfig]',{}); runtimeConfig.insert(data,'runtimeConfig'); } var cols = ''; for(var a in data.runtimeConfig.aggregationRules){ var aggr = data.runtimeConfig.aggregationRules[a]; var col = aggr.colId; if (!col) return; var columnName = col.label || col.name; cols += columnName + '('+ aggr.aggregationType + ')' + ';'; } return cols;}, setter : function(value, data, def) { if(value){ data.runtimeConfig.setProperty('groupingTableAllowed',false); //if aggregation is set - no grouping is allowed data.runtimeConfig.setProperty('groupCol',''); //if aggregation is set - no grouping is allowed } else { data.runtimeConfig.setProperty('aggregationRules'); } }, sideEffects: true, group: 'initALV', priority: 110 } } method compile() var config = [], res = {}, ns = {}, errors = [], expObj = {} var nsName = this.Class.namespace.$name; var nsPref = this.Class.namespace.$pref; ns[nsPref] = nsName; var err = this.validateControl(this.groupCol,'ALV group field'); if (err) this.setProperty('groupCol'); var C=this.Class, props=C.properties; config.push('<'+nsPref+':ALVConfig'); if(this.hasOwnProperty('aggregationsAllowed')) config.push(' aggregationsAllowed="'+ this.aggregationsAllowed +'"'); if(this.hasOwnProperty('filterAllowed')) config.push(' filterAllowed="'+ this.filterAllowed +'"'); if(this.hasOwnProperty('sortAllowed')) config.push(' sortAllowed="'+ this.sortAllowed + '"'); if(this.hasOwnProperty('personalizationAllowed')) config.push(' personalizationAllowed="'+ this.personalizationAllowed + '"'); if(this.hasOwnProperty('settingsAllowed')) config.push(' settingsAllowed="'+ this.settingsAllowed + '"'); if(this.hasOwnProperty('columnSelectionAllowed')) config.push(' columnSelectionAllowed="'+ this.columnSelectionAllowed + '"'); if(this.hasOwnProperty('exportAllowed')) config.push(' exportAllowed="'+ this.exportAllowed + '"'); if(this.hasOwnProperty('graphicsAllowed')) config.push(' graphicsAllowed="'+ this.graphicsAllowed + '"'); if(this.hasOwnProperty('groupingTableAllowed')) config.push(' groupingTableAllowed="'+ this.groupingTableAllowed + '"'); if(this.hasOwnProperty('groupCol')) config.push(' groupCol="' + this.groupCol.id + '"'); if(this.hasOwnProperty('printTableAllowed')) config.push(' printTableAllowed="'+ this.printTableAllowed + '"'); if(this.hasOwnProperty('AggregationBeforeItems')) config.push(' AggregationBeforeItems="'+ this.AggregationBeforeItems + '"'); if(this.hasOwnProperty('scrollableColumns')) config.push(' scrollableColumns="'+ this.scrollableColumns + '"'); if(this.hasOwnProperty('fixedColumns')) config.push(' fixedColumns="'+ this.fixedColumns + '"'); config.push('>'); var initCol = false; for(var s in this.sortRules){ var sortRule = this.sortRules[s]; err = this.validateControl(sortRule.colId,'ALV sort field'); if (err) {sortRule.remove(); continue;} if (err) continue; if(!initCol) {config.push('<'+nsPref+':SortRules>'); initCol = true;} config.push('<'+nsPref+':SortRule'+ ' colId="' + sortRule.colId.id + '" sortOrder="' + sortRule.sortOrder + '" groupAggregation="' + sortRule.groupAggregation + '" position="'+ sortRule.position + '">'); config.push(''); } if (initCol) config.push(''); initCol = false; for(var s in this.aggregationRules){ var aggregationRule = this.aggregationRules[s]; err = this.validateControl(aggregationRule.colId,'ALV calculation field'); if (err) {aggregationRule.remove(); continue;} if (!initCol){ config.push('<'+nsPref+':AggregationRules>'); initCol = true;} config.push('<'+nsPref+':AggregationRule'+ ' colId="' + aggregationRule.colId.id + '" aggregationType="' + aggregationRule.aggregationType + '">'); config.push(''); } if (initCol) config.push(''); config.push(''); if (errors.length > 0) { res.errors = errors; } else { res.results = config.join(''); res.ns = ns; } return res; end; //------------------------------------------------------------------------- method validateControl(obj,prop) //------------------------------------------------------------------------- if (!obj) return; var col = this.unit.getElement(obj.id); if (!col) return('#TEXT[XMSG_CP_ERR_METADATA_COMPILE]'.replace('{0}', prop)); end; method invalidate(control) { if (!control){ if(this.groupCol){ var err = this.validateControl(this.groupCol,'ALV group field'); if (err) this.setProperty('groupCol'); } for(var s in this.sortRules){ var sortRule = this.sortRules[s]; err = this.validateControl(sortRule.colId,'ALV sort field'); if (err) {sortRule.remove(); break;} } for(var s in this.aggregationRules){ var aggregationRule = this.aggregationRules[s]; err = this.validateControl(aggregationRule.colId,'ALV calculation field'); if (err) {aggregationRule.remove();break;} } }else{ //invalidate groupBy if(this.groupCol == control) this.setProperty('groupCol'); for(var s in this.sortRules){ var sortRule = this.sortRules[s]; if(sortRule.colId == control) {sortRule.remove();break;} } for(var s in this.aggregationRules){ var aggregationRule = this.aggregationRules[s]; if(aggregationRule.colId == control) {aggregationRule.remove();break;} } } }