cancel
Showing results for 
Search instead for 
Did you mean: 

How to create event during renderer

Former Member
0 Kudos

Hello,

I'm new in SAPUI5 and i'm trying to create a custom control. The idea of this custom control is to create a table with SVG. I want to add an event onclick but i dont know how to do it because my svg is defined during renderer phase. Have you got any idea or tutorial ?


// SVG

  • oRm.write("<svg id='test_svg' width='1500' height='400' viewBox='0 0 "+xmax*75+" "+ymax*25+" ' " );
  • oRm.writeControlData(oControl); 
  • oRm.write(" >");

for (var i = 0; i <= xmax ; i++ ){

     for (var j = 0 ; j <= ymax ; j++){

           oRm.write("<g transform='translate("+i*75+","+j*25+")'>");

  •           oRm.write("<rect width='75' height='25' style='fill:rgb(132,202,236);stroke-width:0.5;stroke:rgb(0,0,0)' /              
  •           oRm.write("<text fill='white' font-size='6' x='2' y='12' >");
  •           oRm.write("Case "+i+j+"");                                                             
  •           oRm.write("</text>");
  •           oRm.write("</g>");

   } }                             

oRm.write("</svg>");


Arthur

Accepted Solutions (1)

Accepted Solutions (1)

vijay_kumar49
Active Contributor
0 Kudos

Please refer this  example code document . it may be useful  example 1 and example 2


Kindly let me know if you need any more information

Former Member
0 Kudos

It does not help me sorry, my custom control has to create one SVG with severals rectanlges and i want to add the event onclick but i don't know how to proceed

former_member182862
Active Contributor
0 Kudos

Hi Arthur

You have to handle the events in the onAfterRendering function

here is an example

SAPUI5: Signature Pad Control · GitHub

Thanks

-D

Former Member
0 Kudos

Thanks a lot

Answers (0)