cancel
Showing results for 
Search instead for 
Did you mean: 

SAPUI5 Variant key on Save strange behaviour

former_member502756
Discoverer
0 Kudos

I am trying to implement a Variant management in SAPUI5 using Personalization service of sap.ushell.Container. I have written functions to Save, Manage(delete, rename) and select Variants from the drop down. However i see strange behavior when i select a variant in the method mentioned below.

<code>onSelectVariant: function (oEvent) {
    var sSelectedVariantKey = oEvent.getParameter('key');

Assume i have existing variants 'A1', 'A2' and 'A3'. When i SaveAs a new variant with new values (lets call it 'X1'), the new variant is created. Then i select another already existing variant from dropdown( A1 or A2 or A3), i see the corresponding values. Now i again select the newly created variant X1 but i don't see the new values.

When i debug the above mentioned method, i see that for all the existing variants, the oEvent.getParameter('key') returns the variant indexs like 0,1,2,3 etc. but for the newly created variant X1, it returns the value 'sv1579082806311' and hence it doens't find it in variantset

<code>oPersonalizationVariantSet.getVariant(sVariantKey)

and then it doesn't show the new values.

If i run the program again, i see that previously created variant X1 now shows correct values as the method oEvent.getParameter('key') returns the index and not 'sv....'. but if i now create a new variant X2, the same issue happens with X2.

Can someone help me what may be going wrong while saving the variant ?

Thanks

Darsshan H

View Entire Topic
mesicsdaniel
Advisor
Advisor
0 Kudos

I am experiencing the same issue. Does anyone have a solution?

ssrinivas
Advisor
Advisor
0 Kudos

Hi Daniel,

On save success callback function from VM control. You can write below code that would replace the key.

oVM.fireSave = function(oVariantInfo){
.............
............

oVM.replaceKey( AutoGeneratedKey, ValidKey );

oVM.setInitialSelectionKey(ValidKey);

}