problem with onRender event in webclient

Forum to discuss the Web client version of Servoy.

problem with onRender event in webclient

Postby vsoong » Thu Sep 05, 2013 3:35 pm

I am having problem with the onRender event in webclient.

function onRender(event) {
// TODO Auto-generated method stub

/** @type {JSRecord<db:/database_name/stock_items>} */
var myRecordStock = event.getRecord();
var myStock = myRecordStock.stockcode;

I've placed the above onRender function in a text field on table view. When I run it in smart client, it works properly. However, when I run it in webclient, I got the following error message:

TypeError: Cannot read property "stockcode" from (F:\Servoy Projects\TestWebStuff\forms\commitlist.js#37)
at F:\Servoy Projects\TestWebStuff\forms\commitlist.js:37 (onRender)

Is it supposed to work only in smart client but not webclient?

I am using Servoy v7.0
vsoong
 
Posts: 7
Joined: Sat Aug 11, 2012 12:42 am

Re: problem with onRender event in webclient

Postby Harjo » Thu Sep 05, 2013 5:11 pm

Have you tried:

Code: Select all
function onRender(event) {
// TODO Auto-generated method stub

/** @type {JSRecord<db:/database_name/stock_items>} */
var myRecordStock = event.getRecord();
if(myRecordStock {
var myStock = myRecordStock.stockcode;
}
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: problem with onRender event in webclient

Postby chaitanyas » Fri Sep 06, 2013 7:32 am

Hi All,

Yes, Harjo you are correct and the code snippet you have given will work. I have faced same issue and get ride of that by checking if record is exist before accessing the data.



Thanks
Chaitanya s
chaitanyas
 
Posts: 101
Joined: Tue Jul 26, 2011 8:28 am

Re: problem with onRender event in webclient

Postby vsoong » Fri Sep 06, 2013 10:43 am

It is still not working. I have the feeling that "event.getRecord()" does not work in webclient. When I go to debug, the value generated by "event.getRecord()" is "Record". However, when I debug in webclient, the value generated is "null".

Can anyone please confirm that "event.getRecord()" does not work in webclient but runs beautifully in smart client?
vsoong
 
Posts: 7
Joined: Sat Aug 11, 2012 12:42 am


Return to Servoy Web Client

Who is online

Users browsing this forum: No registered users and 2 guests