Skip to Content
author's profile photo Former Member
Former Member

Call default renderer in custom control

Hi there,

I'm trying to extend the sap.ui.commons.TextView.

I'm wondering if it's possible to call the default renderer first and then make some custom changes.

Here's a little code snippet to make clear what I want to do:

// Extend TextView
sap.ui.commons.TextView.extend("my.TextView", {
    init: function() {
        console.log('init');
    },
    renderer: {
        render : function(oRenderManager, oControl) {
            // 1. Call the default parent renderer of the Textview
            
            // 2. Add some custom css or whatever...
            oRenderManager.addStyle('color','green');
            
        }
    }
});

Somebody has a an idea if this is possible?

I've read through the guide here :SAPUI5 SDK - Demo Kit

But there I can only find an example how to override the original renderer, but not how to extend it...

Thanks,

ben

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 27, 2014 at 03:22 PM

    The renderer functions are static you can call sap.ui.commons.TextFieldRenderer.render(oRenderManager, oControl);

    However I think you just need to be careful regarding the ordering of rendering, setting styles etc.

    Regards,

    Jason

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.