columnControl is null

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Segi
Ebase User
Posts: 649
Joined: Mon Dec 09, 2013 6:37 pm

columnControl is null

#1

Postby Segi » Wed Feb 04, 2015 8:39 pm

I have data that is displayed as a table

This is my code:

Code: Select all


tables.EMPLOYEES_REPORT_OFFICELICENSES.fetchTable();

var allOfficeLicenses=tables.EMPLOYEES_REPORT_OFFICELICENSES;
var rows=allOfficeLicenses.getRows();

while(rows.next()) {
     if (allOfficeLicenses.OFFICELICENSECOUNT.value > 1) {
          allOfficeLicenses.FULLNAME.columnControl.setBackgroundColor("yellow");
     }
}
The application is crashing wit the error TypeError: Cannot call method "setBackgroundColor" of null (EMPLOYEES_PRINTREPORT_CLICK#28)

I do this exact same thing on another form with the only difference being that I am referencing a different table. I have verified that the resource has just over 100 rows returned.

Why would it say that columnControl is null ?
0 x

Jon
Moderator
Moderator
Posts: 1342
Joined: Wed Sep 12, 2007 12:49 pm

#2

Postby Jon » Thu Feb 05, 2015 7:28 am

Because column FULLNAME is not included in a Table Control on the current page. It's safer to check for the existence of the column control like this:

Code: Select all

if (allOfficeLicenses.FULLNAME.columnControl)
{
  allOfficeLicenses.FULLNAME.columnControl.setBackgroundColor("yellow");
}
0 x


Who is online

Users browsing this forum: No registered users and 24 guests