I’ve a Form Section, with a Grid Gadget.

If I try to set:

oGridGadget = lianja.get("mypage.section.gridgadget")
oGridGadget.setattr("controlSource", "filterricerca")

I get the error:

gio ott 6 10:10:16 2016
**** Lianja error ****
USE “filterricerca” IN 0
File ‘filterricerca.dbf’ does not exist

where filterricerca is a cursor:

create cursor filterricerca (&cursorField)
select filterricerca
append blank

Is possible to use a cursor as a datasource of a Grid Gadget?

My goal is: create a universal “Search page”.
This must function to look up data on a table or on a query.
Item table: search for articles with “screw” in the description, and “12” in size.
Sales Order: search for customer orders of “Bologna”

In the first case is a search on a single table, in the second I have to do a query on Orders and Customers.

In the example I have a table “Articoli” (items) and a VT “VT_Articoli”, accessed via ODBC from a DB FoxPro 2.6 ..


Name: 2016-10-07 15_16_57-Nuova notifica.jpg Views: 51 Size: 84.6 KB

To do this I set a namespace var:

namespace MyNameSpace

public m_mainTable
public m_searchtable, m_searchfields, m_searchcaption, m_searchtarget, m_searchcursor, m_searchjoin, m_searchfilename, m_searchorder, p_sRetVal

MyNameSpace.m_searchtable = 'articoli,vt_articoli'
MyNameSpace.m_searchfields = 'articoli.cod_art|;articoli.gruppo|; tmercgam|;articoli.des_web|'
MyNameSpace.m_searchcaption = 'Articolo,Gruppo,Categoria,Descrizione'
MyNameSpace.m_searchtarget = 'cod_art'
MyNameSpace.m_searchcursor = 'cur_articoli'
MyNameSpace.m_searchjoin = 'articoli.cod_art=vt_articoli.cod_art'
MyNameSpace.m_searchfilename = ''
MyNameSpace.m_searchorder = ''


m_searchtable represent the table involved in the query (one or more)
m_searchfields represent the fields displayed by default in the result
m_searchcaption is the relative field caption
m_searchtarget is the returned field
m_searchcursor is the name of the query
m_searchjoin is the relation between the tables

the function callSupSearch_x(,
call the server page…

lianja.showDialog("sem_search", "pageSearch", 800)

in the server page I create a cursor, with the “m_searchfields” and the “m_searchcaption”, I create the menu, with the table involved in the query.

Just typing in the Filter cursor, I do a query and refresh the “Results” in the webview.

When the user click on the menu “Articoli”, I update the filtergrid, I create a new cursor with the structure of the table “Articoli” and I display all the columns.. the user can type any search string in any column..
I refresh the query..

For the Filter cursor, I can only use a Custom VFP Section where I change the “Browse or Edit command”…

I can not use the more beautiful “Grid gadget”..


No, it expects a table name.


I believe you can also use temp tables (at least that how I understand them) instead of a cursor.

If you select into a table that has a name that starts with an underscore, it is not part of the database.
select * from a into _temp1.

You can create a temporary table that is not in the database.

I know of two ways.

1. Create table c:\tempfabio free(Firstname Char(10), Id int)

By using the word free, it keeps it standalone.

2. use a table that starts with an underscore.

Select * from masterfabio into table _tempfabio



On a canvas grid, the selected row has a dotted outline. Is it possible to highlight the selected row with a color?


You can do it through CSS, e.g.

Name: canvasGridCSS.jpg Views: 81 Size: 91.0 KB

Name of control: grdClientList

CSS Style: app:/clientlist_section1_grdClientList_cssstyle.css

clientlist_section1_grdClientList_cssstyle.css contents:

lianja_ui_tree::item:selected {
border: 3px solid blue;

lianja_ui_tree {
font-size: 28px;

I changed the setting for “Can select rows” to True and the CSS formatting is working now,


I was wondering if you were wanting to change the border as you moved the mouse over the rows rather than when you actually selected a row.

If anyone else is interested in this, you can use the ‘hover’ pseudo-state, e.g.

lianja_ui_tree::item:hover { 
	border: 3px solid blue;


I am trying to sort my grid section in descending order on column 0. below is the code I have tried. It seems like it should work. Does anyone see an obvious problem.

oGrid = Lianja.get("rfrmain.RFRList").grid
oGrid.sort(0,-1) //sorts grid in decending order by rfr no ---not working


Make sure the ‘Sortable’ attribute is checked (True) for the Grid Section (in the Details attributes).

You won’t need the refresh().


How do I specify the background color for a row or cell in custom vfp section grid?


Cell dynamic background/foreground attributes are currently only available on Grid Section Columns.

If you just want to color the selected / hovered over row, this can be done through CSS :…ighlight-color.


I have a grid bound to a table in a custom VFP Section.
As users fulfill different actions, I need to be able to change the color of specific cell backgrounds.

I know the cell I want, how do change the backcolor programmaticly ?
I have looked at Dynamic Cell Background, but this is not based on a table value.

would it be something along of the line of

sCell = namespace.grid.item(x,y)

I am using a custom VFP section and hand creating all of my objects.

Meaning – in my code, I use addobject(), so the attributes need to be exposed on a programmatic level.


As far as I am aware, you can access the backcolor and forecolor of the column, but not an individual cell.

Grid.item(x,y) returns the text from a cell, not an object reference to the cell.




I have grid named verGrid in custom VFP section.

How would I reference an individual column to make it read-only or change the header?


vergrid.columns(1).readonly = .t.


The highlighted row in a grid section seems to always be the first row in the grid when the page is initially displayed.

How can I have the grid highlighted on a row of my choosing when the page is displayed?

I have a page with a grid section on it bound to a table in my database called CLIENT.

In the DblClick delegate for the grid section, I capture the Cid column value from the CLIENT table to a public variable and then ShowDocument() to a different page in my app.

When the other page is closed, I return to the original grid section page and in the Activate delegate, I have the following

proc clientmaint_section1_activate()     
    Select CLIENT
    Locate for Cid = LastClientID
    Wait Window "Record Number = " + Transform(RECNO("CLIENT")) + "... "+CLIENT.cid Timeout 1.5

The Wait Window command shows the table on the correct record with the correct cid, but when the page appears, the grid’s highlighted row is the top record.

I have also tried to use the following:



You are trying to use the Next method on a section rather than on a grid. Try something like…

Lianja.getElementById(“clientmaint.section1.grid1” ).Next

the correct notation is :



Add a blank grid section to an application: In a JavaScript application, I am trying to add a blank grid and then populate it later from an array using additems().


Here’s what I did in on app:

1) created a table with the required fields and also had a cSession field of C(26).
2) in the UI, I added a property to a public var oApp of cSessionID
3) this property was, on the INIT of the UI app, set to guid() (this was in VFP, but should work here)
4) I then set a filter on the grid of: cSessionID = oapp.cSessionID — which meant the grid was showing empty
5) Then I could “create” records from anywhere, making certain to use oapp.cSessionID as the cSessionID of the table.

The same could be done with a VT and a parameter for cSessionID of course.

In the close of the database (assuming you don’t close it in the UI), you can delete for cSessionID = oapp.cSessionID.


grids in a custom VFP section.

using addcolumn, how do I specify the header text and rowsource for the column?


After addcolumn()… you can get objects (column and header)

The Column object (returned from grid.columns(n) has a property called Header1 that returns a reference to the Header object for that column. e.g.


oCol1 = grid1.columns(1)
oHeader = oCol1.header1
oHeader.caption = "This is Column 1"
proc page1_section1
    page1_section1 = createobject("page1_section1")
    page1_section1.addobject("mygrid", "grid")
    oCol1 = mygrid.columns(1)
    oHeader = oCol1.header1
    oHeader.caption = "This is Column 1"

    oCol2 = mygrid.columns(2)
    oHeader2 = oCol2.header1
    oHeader2.caption = "This is Column 2"
return page1_section1


Is there a way to prevent deleted items from showing on a grid.


If SET DELETED is ON, then records that have been marked for deletion are ’invisible’

If the grid is set to “Double click to edit“, you can navigate the records in the grid using the mouse and/or the cursor/page keys as previously.

However, In Lianja 3.2 pressing “Return/Enter” switches the row into edit mode (and displays the record for editing in the split view Form if that is enabled).

While editing, pressing Ctrl+W or Esc in the “Form View” focuses back onto the grid.



How do I set up an SQL statement as a grid source? I can’t find any information on how to get this working.

Name: lianja grid with sql.jpg Views: 44 Size: 31.9 KB


The grid does not adjust columns based on the SQL statement: they are set up in development mode only.

You can make columns non visible at runtime.

You can requery with an entirely new WHERE clause.


It’s more specific to desktop apps.

It is better to use Virtual Tables if you want to target web and/or mobile.

I’d really recommend going through the examples opening them up and then run them in web and mobile then you will see what can be accomplished with very little coding.

It’s important to realize that Lianja/VFP does not run in the browser but it can be used to generate dynamic content that is rendered in WebViews and DialogPanels.

The “client-side” delegates should be written in JavaScript.

You will find that the majority of VFP functions are available in the Lianja JavaScript framework.

You can play with these in the Web inspector | Console. Remember JavaScript is a case sensitive language.



you can use also a Custom VFP Section and use the “Browse” command.
Name: 2017-01-10 06_10_38-Rina - Dev.jpg Views: 43 Size: 70.4 KB

In this case, bsed on the menu choice, I browse a different table.
Name: 2017-01-10 06_11_09-Lianja App Builder v3.2.0 [sem_search] - UTF-8 - southwind - Licensed to Sof.jpg Views: 38 Size: 29.8 KB

You cau use the “setattr” to change the displayed table at runtime.

loFilter.setAttr(“browseCommand”, “browse noappend noactionbar noedit nodelete fields ” + lsBrowse + lsStyle)

Desktop client only. It’s VFP browse embedded in a page.

how to dynamically load data into forms and grids.

In LIanja 3.5 I have implemented the getJSON() and the setJSON(data) methods on sections in the Web and Mobile to simplify this.

You can dynamically query data using OData_Read() (or other means) and then load the form, canvas or grid section with the data. The setJSON(data) method for a grid is aware of the OData JSON format returned from OData_Read().

Name: Screen Shot 2017-05-31 at 2.14.08 PM.jpg Views: 92 Size: 96.6 KB

After loading a grid you can edit the rows of the grid as normal and save it..

You can always override navigation bar actions with custom actions and these can perform updates Server-side.

Also worth mentioning is that after setJSON(data) on a section, any related child sections and sidebars are refreshed automatically, so it operates in the same way as a standard section.


In one page, I have canvas section and grid section. Canvas section has 2 numeric fields and a command button.
Grid section had an empty table.
When user input 2 numbers, and click the command button, I insert into the table with the computed (var 1*var 2) but the grid does not refresh! I exit the App and view the table, the var was indeed inserted.
Any ideas to refresh the grid section dynamically?


use (“section1”).refresh


I thought you wanted to create the grid “on the fly”.

If you do not need to edit the data, you can use a Web view, else you can use a Custom Fox Pro section and you can change the “command”

Name:  2017-05-15 09_13_21-Lianja App Builder v3.4.1 [dd_search] - UTF-8 - southwind - Licensed to Soft.jpg Views: 34 Size:  79.6 KB

browse noappend noactionbar noedit nodelete fields ORDERS__ORDERID :25 :H=”Campo Ordine”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders” ,”ORDERS__ORDERID”),ORDERS__ORDERID__sort :10 :C=”no,up,down”:H=”up/dn”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”OR DERS__ORDERID__sort”),ORDERS__CUSTOMERID :25 :H=”Campo Cliente”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders “,”ORDERS__CUSTOMERID”),ORDERS__CUSTOMERID__so rt :10 :C=”no,up,down”:H=”up/dn”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”OR DERS__CUSTOMERID__sort”),ORDERS__SHIPNAME :25 :H=”Campo Spedire a”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”ORD ERS__SHIPNAME”),ORDERS__SHIPNAME__sort :10 :C=”no,up,down”:H=”up/dn”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”OR DERS__SHIPNAME__sort”),CUSTOMERS__CONTACTNAME :25 :H=”Campo Rag. soc.”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,” CUSTOMERS__CONTACTNAME”),CUSTOMERS__CONTACTNAME__s ort :10 :C=”no,up,down”:H=”up/dn”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”CU STOMERS__CONTACTNAME__sort”),ORDERS__ORDERDATE :25 :H=”Campo Data ordine”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders” ,”ORDERS__ORDERDATE”),ORDERS__ORDERDATE__sort :10 :C=”no,up,down”:H=”up/dn”:V=pageSearch_ValidFiltro(“{}”,”cur_Orders”,”OR DERS__ORDERDATE__sort”)style “* { selection-color:yellow; selection-background-color:black;font: bold 15px Arial; gridline-color:green; background:black;color:yellow;} QTableView::item {background:lightgreen; } QHeaderView::section { background-color:green;color:white;border:0px;font: bold 15px/30px Georgia, serif; } ”




Leave a Reply

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

You are commenting using your 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.