How would I do the following in Javascript?

oGrid = Lianja.get("page1.section2").grid
nActiveRow = oGrid.ActiveRow
nCommNum = oGrid.item(oGrid.ActiveRow,3)

if we need to get the value for a particular column on the current row, how might we do that?
My grid is bound to a virtual table.
Say VT name is QWERTY, active row is 5 and column data is in column 8.
Web Client grid does not yet support the accessing of individual cells of the grid like that. furthmore it always uses pagination by design to provide acceptable performance on web and mobile devices.
The grid columns are data bound. Selecting a row makes that record active in the cursor. So you reference the columns from the cursor.

var orders = Lianja.getCursor("orders");
var customerid = orders.getData("customerid");

Double clicking a row in the web client will edit the row.
Clicking a grid row will select it. The record is made current in the cursor. The related sections are then refreshed.
You can click on a row and use the JavaScript console to access the cursor as I previously described to satisfy yourself.

JavaScript console in the browser. You can inspect the client environment

If I want to not worry with web compability it is much better to develop everything in Javascript. Is this also applicable to the development for mobile devices?
Python, PHP and JavaScript are case sensitive. Lianja/VFP is case insensitive, so Lianja.showDocument() is what you need to use.
Web and Mobile use JavaScript on the client (delegates) but the client side code can call server side code written in Lianja/VFP or JavaScript. We will be adding PHP and Python into the cloud server in a point release after v2.0 is released.

Lianja framework includes most of the VFP built in functions in JavaScript and also that the LOM (Lianja Object Model) is available in desktop, web and mobile apps in all of the supported scripting languages.
The visual nature of Lianja development does not require extensive JavaScript coding so let’s not make it look like it does.
Apps are built out of pages and pages are built out of sections, all visually setting attributes to affect the appearance and behavior of the UI.
The only place you really need to do any JavaScript programming is if you need to handle special actions through delegates that act as a proxy to call server side Lianja/VFP procedures. This too was simplified in v2.0 with automatic proxying to server side business procedures.

Any server side business logic procedures can be used in validation expressions, used in {…} macros, called using Lianja.evaluate() or setup as remote procedure calls
Building Web and/or mobile Apps requires a separation between the UI presentation and the server side business logic.

JavaScript variables are scoped just like local in VFP.

if in a JavaScript function you type

var var1;

then its its local to that function.

It is good practice to place your own global variables in a global object called public. This prevents any references to the wrong variable from being made. It also simplifies debugging as you can just type public in the JavaScript console which will display the public object and all its members.

public = {};
public.var1 = "hello world";
public.var2 = 12345;

When I click any menu item, the console reports the following error:
**** Lianja JavaScript error ****
Traceback (most recent call last):
() at 1ReferenceError: Can’t find variable: Client_MainHeader_customsectionmenu

Here is the code in the function:

function client_mainheader_customsectionmenu(cItem)
        cItem = ALLTRIM(UPPER(cItem));
        messagebox("Menu item is: " + cItem);

Here are the errors being reported:
Traceback (most recent call last):
client_mainheader_customsectionmenu(cItem = ‘Reset’) at 3
() at 1
ReferenceError: Can’t find variable: ALLTRIM

**** Lianja JavaScript error ****
Traceback (most recent call last):
client_mainheader_customsectionmenu(cItem = ‘Reset’) at 3
() at 1ReferenceError: Can’t find variable: UPPER

Most likely would be the ‘}’ missing from the end of a function or a line that needs to be terminated missing the ;.
Lianja functions need to be in lowercase in order to work properly.
JavaScript is a case sensitive scripting language whereas Lianja/VFP is case insensitive so you need to use the exact function name as it is documented.

I am trying to check if a section is visible or not and the boolean comparison seems to be the issue.

if Lianja.get("client.secSearch").visible == false

How should boolean values be fully written for comparison?
I have tried various ways including: = .F., == false, === false
Try this:

if (Lianja.get("client.secSearch").visible == 0)

Categories JS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s