remove a column in grid section
You might not know that you can also right-click on a Grid Column Header to display an additional menu of options:

This gives you an alternative access to the Column’s Attributes, the options to add a blank Column before or after the current Column and allows you to remove the current Column from the Grid.
Remember you can add the Column back in if you change your mind, by dragging the field from the ‘Column Names’ in the Sidebar into the Grid and you can rearrange the Column order in the Grid by dragging a column by its header.


ALTER TABLE "test" MODIFY CONSTRAINT AMOUNT SET ERROR "Error, amount must be between 100 and 200"

No error,
I did check it on the table and it’s correct.
when input in the table, it won’t display the errortest after wrong input, the check itself works correct.
It works when I place the field in a textbox.
It doen’t work in a browse or grid.
Grids do not currently ‘Inherit dictionary rules’ – Form and Canvas Sections can (off by default, check the Attribute to enable).
Your validation check will be evaluated when the data is saved to the table and the update rejected if the validation fails, but the error message will not be shown in the Grid.

Next() and previous() are for skipping pages of records. Your grids don’t have pages of records as you have pagination off.

you don’t need to refresh the whole grid you can just refreshRecno( nRecno) which you obtain just like you did with rowid but reference recno instead.

can i use cursor in to a grid section
A dynamic grid like that which is not bound to a fixed data source cannot be related from a parent section or have child sections as it is not constant.
So if you want to dynamically have a grid on a dynamically chosen table or query then use a custom section.
If you take a look at the canvas demo example it shows you how to do that without using a temporary table. You can just add rows to the grid and recalc subtotals and grand totals.

I had a situation where I wanted to populate a grid with a cursor that I had generated; allow the user to edit the data; and have data rules applied from the data dictionary.
What I did was create a table that had a special field in it, cFilterExp C(36). When the user went to the page where that grid resided, I used guid() to create a guid, created the rows in the table which was shared by all users, put the guid() in the cFilterExp of each row, and set the filter of the section to that same guid() value. When the page was used with new data, a routine deleted the records from the table based on the old guid(), etc.
I like working with tables/cursors much more than manually adding data to a grid, and having a real cursor gave me the ability to use dbf() to append the data to the real table. It was actually pretty efficient.

The grid is read only.
I plan to move through the grid and edit any record I select in it, in the Edit Grid section.
Clicking any row in the grid shows the record in the Events Edit section as expected.
However I can’t move through the grid using the cursor keys on the keyboard. i.e Focus doesn’t move from the selected row.
If you uncheck the Readonly for the Grid Section then make the Columns in the Grid Reaonly (double-click the Column header to open the Attributes), you will be able to use the cursor keys to move between rows in the Grid.
The editable Grid + readonly columns will only give you cursor movement in the Desktop Client, not in the Web Client. Grid Sections in the Web Client (and Desktop Client) respond to touch and mouse/touchpad movement and clicks.

If you create a hyperlink for items in a grid, how do you link clicks on that item to open another page/report and go to that record?
With the ‘Hyperlink’ Attribute of a Grid Section Column checked to True (double-click the Column Header to access the Attributes), the containing Grid Section ‘Link Click’ event delegate is called when the link is clicked. The event delegate is passed two parameters: the ‘Data source’ of the Column and the value of the clicked cell.
Lianja.showDocument() can be used for actions such as selecting another Page, searching for a value using the Page Search field etc.
For the Lianja Web Client, the link value will need to be unique to be able to identify the record in the ‘Link Click’ event delegate.

“Cell dynamic background” and “Cell dynamic foreground” are not currently supported on the Lianja Web Client.
On the Desktop Client, they are not exposed as properties, but the attributes take an expression. This could be a comparison to a memory variable or other data or you can specify a Lianja/VFP UDF (user defined function) that returns the color, e.g. for a character column value:
Your myfunc.prg or myfunc function in a library is passed the current cell value and can then do any processing or checks required before returning the color. Calling the section.refresh() will re-evaluate the expressions in the attributes.

The Canvas Section grid/TreeGrid is based on the Tree class rather than the Grid Section and does not have “Cell dynamic background” and “Cell dynamic foreground”.

It does have the option of specifying an icon on the row – maybe this would work for you as an alternative?

In the screenshot below, I’ve used the lianjacustomcanvas App and specified an icon at the start of the row in the Cart, changing the icon depending on the Cart item’s total.

Note: Desktop App

In a page I’ve a custom section, with only one textbox (textboxa) and a grid section, based on a table (tableA).

In the “change” delegate of “textboxa” I wrote:

select tableA
append blank
replace field1 with "jjj", field2 with "ggg" etc.

in the grid, I see only blank record…
like as the “commit” rewrite my field…
if I remove the gridsection, all work fine…
Try a

skip 0

after the replace line.

When I press “Enter” I insert a record in the third grid “Game Log”, the lower one, and update even the score in the second (that of Set).
When I do a refresh of the second (SET, to refresh the score), the third grid will always show me the Log of the first set .. even if they are on the second or third ..
You should be able to use grid.activerow and grid.activatecell when you refresh the Grid Section, e.g.:

oGrid = Lianja.get("scout.set").grid
lnActiveRow = oGrid.activerow
oGrid.activatecell(lnActive Row, 1)


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