cancel
Showing results for 
Search instead for 
Did you mean: 

SDK Setvisible error

Former Member
0 Kudos

Hi all,

I've created some SDK components, and it works fine until I use the Setvisible function.

I'm using the SAPIU5 component rangeslide.

when I set the visibility state to 'true' the first time it works fine, but when I set it to 'false' and then back to 'true' the JS gets stuck and I cant find out what's the error.

this is my init function where the code is returning the exception:



this.init = function() {

if (this._alive) {

            this._sl.placeAt(this.$());

            return;

} else {

            var oSlider = new sap.ui.commons.RangeSlider({

                id : 'RangeSlider',

                tooltip: 'RangeSlider',

                width: '90%',                 

                totalUnits: 10,

                value: 0,

                value2: 10,

                smallStepWidth: 1,

                stepLabels : true,

                change : function() {

                            sValue1 = oSlider.getValue();

                            sValue2 = oSlider.getValue2();

                            that.firePropertiesChanged(["SValue1"]);

                            that.firePropertiesChanged(["SValue2"]);

                            that.fireEvent("onChange");

                        }

           });

  

           oSlider.placeAt(this.$());

            this._sl = oSlider;

            this._alive = true;

        };

};

Is there any thing special needed to be handle in the init function in order to overcome this back and forth scenario?

Accepted Solutions (1)

Accepted Solutions (1)

MustafaBensan
Active Contributor
0 Kudos

Hi Amit,

Based on your code snippet, my initial observation is that you seem to be instantiating the SAPUI5 control using the "div" handler type for the SDK component.  The SAP recommended and supported approach is to use the "sapui5" handler type as documented in Section 6 (SDK Extensions Using SAPUI5 Controls) of the Design Studio SKD Developer Guide.

I would suggest that you first apply this approach to ensure you have implemented the component using the SAP supported method.  If you continue to experience the same issue, we can then evaluate your code in more detail to try to determine the cause.

Also note that the placeAt() method is not officially supported for instantiating SAPUI5 controls and not required when you use the "sapui5" handler type as recommended by SAP.

There is an example of the implementation of an SDK component using the SAPUI5 slider control included with the SDK samples, and documented in Section 7.20 of the Developer Guide.

Regards,

Mustafa.

Message was edited by: Mustafa Bensan

Answers (1)

Answers (1)

former_member183473
Participant
0 Kudos

Amit,

I had a similar problem, and could not figure out why I couldn't set my component back to visible, And Mustafa I was using the SAPUI5 handler.

What I did to overcome it, was place it inside a standart component, a Panel for example.

And then set that one  visible or not.

Hope this helps.

Best

Leandro