PDA

View Full Version : OnClick not being fired for object in webapp.src



Oscar
26-Oct-2020, 05:17 PM
Hi All,

I have a problem with the OnClick event not getting fired for a cWebHtmlBox if the object is placed on the WebApp.src, they do work ok when they are on a .wo insice a cWebView. Is that by design? or could it be fix?

This is the code I am using:


Use AllWebAppClasses.pkg
Use cWebMenuItemLoadView.pkg


Object oApplication is a cApplication
End_Object


Object oWebApp is a cWebApp
Set psTheme to "Df_Material"
Set peApplicationStateMode to asmHistoryAndUrls
Set psEncryptPassword to "<(PQN@B9F/Q#f7/G{MI>#n7.i"


Object oWebTopPanel is a cWebPanel
Set piColumnCount to 24
Set peRegion to prTop
Set piHeight to 0
// - - - - - - - - - - - - - - -
// Main Panel's Responsive Rules
// - - - - - - - - - - - - - - -
WebSetResponsive piColumnCount rmMobile to 2
WebSetResponsive piColumnCount rmTabletPortrait to 16

Object oTiles_grp is a cWebGroup
Set piColumnSpan to 24
Set pbShowBorder to False
Set pbShowCaption to False
Set piColumnCount to 16

Set psCSSClass to "TilesGroup"


Object oTile4 is a cWebHtmlBox
Set pbServerOnClick to True <<-- pbServerOnClick SET TO TRUE
Set piColumnSpan to 2
Set piColumnIndex to 6
Set psCSSClass to "Tile DarkAlternate"
Set psHtml to '<div class="WebCon_Sizer" data-ServerOnClick="openview"><div Class="Tile_Title">Tile 4</div><div class="Tile_Subtitle"></div></div>'

Procedure OnLoad
Send UpdateHTML ('<div class="WebCon_Sizer">' + ;
'<div class="Tile_Title">' - htmlEncode("45") - '</div>' +;
'<div class="Tile_Title">Open Approvals</div>' +;
'</div>')
End_Procedure

WebRegisterPath ntNavigateForwardCustom oOpenApprovals

Procedure OnClick String sId String sParam <<-- NEVER GETS FIRED
Send NavigatePath
End_Procedure

End_Object
End_Object

End_Object


Use SessionManager.wo
Use LoginDialog.wo
Use WebResourceManager.wo
Use OpenApprovals.wo

End_Object


Send StartWebApp of oWebApp


Regards,
Oscar

Harm Wibier
27-Oct-2020, 06:09 AM
Hi Oscar,

In the HTML that you send in OnLoad you didn't include the data-ServerOnClick attribute. So that is why it doesn't fire OnClick.

Regards,

Oscar
27-Oct-2020, 08:36 AM
Hi Harm,

Thank you, but when I add the data-ServerOnClick as shown below it still does not work (btw, I used the generated code to start, the UpdateHTML is on the welcome tile and I understand that it is not needed there, but it does not have the data-ServerOnClick on it... you might want to add it so others don't make the same mistake I did.)



Procedure OnLoad
Send UpdateHTML ('<div class="WebCon_Sizer data-ServerOnClick="openview"">' + ;
'<div class="Tile_Title">' - htmlEncode("45") - '</div>' +;
'<div class="Tile_Title">Open Approvals</div>' +;
'</div>')
End_Procedure

WebRegisterPath ntNavigateForwardCustom oOpenApprovals

Procedure OnClick String sId String sParam
Send NavigatePath
End_Procedure


Regards,
Oscar

Evertjan Dondergoor
27-Oct-2020, 02:58 PM
You need a quote after the Webcon_Sizer, as that is the class. Than after openview you have two quotes, should be only one.

Oscar
27-Oct-2020, 03:03 PM
Hi Evertjan,

Thank you!!!

Feeling dumb... but happy you were able to see the issue. Can't believe that I missed that.

Regards,
Oscar