Skip to Content
0
Former Member
Dec 29, 2015 at 07:15 AM

Question on extending sap.m.StandardListItem

96 Views

Hello,

i would like to ask a question on extending sap.m.StandardListItem.

What i've done:

I have a single page app using a xml view. Within this view i declared the following:

xmlns:my=my

In the List:

<my:extendedStandardListItem title="{title}" newattr="{newattr}></my:extendedStandardListItem>

The binding of model data works fine:

I've created the JS file.

extendedStandardListItem.js containing the following:

jQuery.sap.declare("my.extendedStandardListItem);

sap.m.StandardListItem.extend(my.extendedStandardListItem", {

metadata{

library:"sap.m",

properties{

newattr :{ type:"string", group:"Misc", defaultValue:null}

},

renderer:function(oRm, oControl) {

//my.extendedStandardListItemRenderer.render(oRm,oControl) //This doesn't work -> Instead of calling the render Method of my.extendedStandardListItemRenderer it calls itself again and again until there is a callstack overflow

sap.m.StandardListItemRenderer.render(oRm, oControl); //This works & renders the standard Listitem correctly

}

The second JS file if created ist the following:

extendedStandardListItemRenderer.JS containing the following:


jQuery.sap.declare("my.extendedStandardListItemRenderer );

sap.m.StandardListItemRenderer.extend("my.extendedStandardListItemRenderer ", {

metadata:{

library:"sap.m"

}, renderer:function(oRm,oControl) { //<- This method doesnt get called

console.log("test rendering extendedStandardListItemRenderer );

}


Now the questions:

1) How do i have to call the render function of extendedStandardListItemRenderer?

2) How do i call the super() method in the render function of extendedStandardListItemRenderer?


Thank you for your your help. I'll reward points for any helpful and/or correct answers.


Have a nice day.


Regards,

Michael