SAPUI5变体管理-未保存默认值和公共

2020-09-09 14:13发布

点击此处---> 群内免费提供SAP练习系统(在群公告中)加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)你好 我正在使用正在保存的变体...

         点击此处--->   EasySAP.com群内免费提供SAP练习系统(在群公告中)

加入QQ群:457200227(SAP S4 HANA技术交流) 群内免费提供SAP练习系统(在群公告中)


你好

我正在使用正在保存的变体管理,但选中时不使用"默认"或"公共"。 这是我的代码:

xml:

控制器:

//变式管理_getAllVariants:函数(fnCallBack){var oPersonalizationVariantSet = {},aExistingVariants = [],aVariantKeysAndNames = []; //获取shell的个性化服务this._oPersonalizationService = sap.ushell.Container.getService(" Personalization"); //从个性化服务中获取容器this._oPersonalizationContainer = this._oPersonalizationService.getPersonalizationContainer(" MyVariantContainer"); this._oPersonalizationContainer.fail(function(){fnCallBack(aExistingVariants);}); this._oPersonalizationContainer.done(function(oPersonalizationContainer){//从容器中检索vaariantset if(!(oPersonalizationContainer.containsVariantSet(" SOStatVariants"))){oPersonalizationContainer.addVariantSet(" SOStatVariantization" Ptain。 "); aVariantKeysAndNames = oPersonalizationVariantSet.getVariantNamesAndKeys();//为现有变体创建对象以绑定varinatmanagement控制,以查看(aVariantKeysAndNames中的var key){if((aVariantKeysAndNames.hasOwnProtty(Key)){Item VariantKey = aVariantKeysAndNames [key]; oVariantItemObject.VariantName = key; aExistingVariants.push(oVariantItemObject);}} fnCallBack(aExistingVariants);} .bind(this)); },onSaveAsVariant:函数(oEvent){var SelectedFilterData = this.getView()。getModel(" filterViewModel")。getData(); var TableFilterData = this.getOwnerComponent()。getModel(" variantTableColumnModel")。getData(); //this.getView()。byId(" idResultTable")._ getVisibleColumns(); console.log(SelectedFilterData); ////this.getOwnerComponent()。saveVariant(this._oPersonalizationContainer,oEvent.getParameter(" name"),SelectedFilterData,function(){////执行所需的操作//} .bind(this)); this.saveVariant(oEvent.getParameter(" name"),SelectedFilterData,TableFilterData,function(){//执行所需的操作console.log('here!');} .bind(this)); },/** *此方法用于保存变量* @param {String} sVariantName-变量名* @param {Object} oFilterData-过滤数据对象-> JSON中的合并过滤器* @param {Function} fnCallBack-调用 带有变体数组的back函数*/saveVariant:function(sVariantName,oFilterData,oTableData,fnCallBack){//将变体保存在个性化容器console.log(oFilterData); this._oPersonalizationContainer.fail(function(){//失败时回调函数fnCallBack(false);}); this._oPersonalizationContainer.done(function(oPersonalizationContainer){var oPersonalizationVariantSet = {},oVariant = {},sVariantKey ="";//检查当前变量集是否存在,如果不存在,则将新变量集添加到容器中,如果( !(oPersonalizationContainer.containsVariantSet(" SOStatVariants"))){oPersonalizationContainer.addVariantSet(" SOStatVariants");}//获取变量集oPersonalizationVariantSet = oPersonalizationContainer.getVariantSet(" SOStatVariants" add)如果存在,或者//变体sVariantKey = oPersonalizationVariantSet.getVariantKeyByName(sVariantName); if(sVariantKey){oVariant = oPersonalizationVariantSet.getVariant(sVariantKey);} else {oVariant = oPersonalizationVariantSet(){Value,"();( JSON.stringify(oFilterData));} if(oTableData){oVariant.setItemValue(" Table",JSON.stringify(oTableData));} oPersonalizationContainer.save()。fail(function(){//调用回调fn wi 错误的fnCallBack(false); })。done(function(){//使用true fnCallBack(true);} .bind(this))进行回调 } .bind(this)); },onManageVariant:函数(oEvent){var aDeletedVariants = oEvent.mParameters.deleted,aRenamedVariants = oEvent.mParameters.renamed,sNewDefaultVariantKey = oEvent.mParameters.def if(aDeletedVariants.length> 0){this.deleteVariants(aDeletedVariants,function(bDeleted){//如果bDeleted为true,则删除成功)); } if(aRenamedVariants.length> 0){//从变体集中获取变体,并在个性化变体集中将其重命名,然后保存。 }},deleteVariants:函数(aVariantKeys,fnCallback){var oPersonalizationVariantSet = {}; this._oPersonalizationContainer.fail(function(){//处理失败的情况}); this._oPersonalizationContainer.done(function(oPersonalizationContainer){if(!(oPersonalizationContainer.containsVariantSet(" SOStatVariants"))){oPersonalizationContainer.addVariantSet(" SOStatVariants");} oPersonalizationVariantSet(O; iCount = 0; iCount

5条回答

嗨,

我遵循了这种方法,并且能够保存,选择和删除变体。 但是我不知道如何设置为默认变量? 。 varinatSetcontroller有什么可用的方法吗?

一周热门 更多>