Q:
graphical checkbox in a grid column
A:
Currently not supported. You can however put combo boxes in grids using Static or dynamic choicelists.
Grid Column Attributes are accessed by double-clicking on the Grid Column Header. These Attributes then apply to the Column in the 'Grid View' and also in the 'Form View' when you are using a Split Grid.
In the Lianja App Builder, you are probably used to the idea of double-clicking on a control or container's header or caption to access its Attributes and the same is true for a Grid Column:
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.
Web Client Grid sections have a standard Save/Cancel/Add/Edit/Delete actionbar in the header unless the Grid itself is Readonly.
You can call the grid.sort() method
The Sort delegate is not currently called when clicking on the column headers.Code:oGrid = Lianja.get("page1.section1").grid
// sort 3rd column ascending
// columns start from 0
// direction: 1=ascending, -1 = descending
oGrid.sort(2,1)
I'll check on support in JavaScript and the Web Client.
Split Grids are normal Grid Sections with the ability to display a single record Form View within the Section. In the lianjademo App, the Orders and Order Details grids in the 'Customers Orders' dashboard are both Split Grids.
You set Split Grid behaviour in the Grid Section Attributes, checking 'Double click to edit' and/or 'Split grid'.
With 'Double click to edit' set, double-clicking on a Grid row displays a single record Form in the grid. If you have memo or object (e.g. image) fields, check the 'Show memo/object panel' attribute.
http://www.lianja.com/community/atta...6&d=1394721038
Tip: hover your mouse over the join between the grid and the Form View to display a handle allowing your to resize the width of the Form View or hide it completely. There's also a resize handle for the height of the memo panel, just hover your mouse at the top of the panel header to reveal it.
Checking 'Split grid' gives you three possible 'Views' for the grid and displays buttons in the grid header allowing you to switch between them.
http://www.lianja.com/community/atta...7&d=1394721059
Split View:
http://www.lianja.com/community/atta...8&d=1394721074
Form View:
http://www.lianja.com/community/atta...9&d=1394721085
Grid View:
http://www.lianja.com/community/atta...0&d=1394721098
ip: the displayed columns/fields are the same in the Form View as in the Grid View, i.e. a 'removed' column will not display in the Form View. They are also displayed in the same order - remember you can reorder the columns in a grid by dragging a column header over another.
For a standard Grid Section, this appears to working fine:
Code:Lianja.get("section2").refresh()
Q:
The Sort() method in the Grid takes 2 parameters nColumn, nDirection but where do they come from & how does it work?
A:
the number refers to the order of columns in a table, as displayed in the data manager. I haven't tried (yet) to use macros there, with a routine that would use afields() to get the order from the name. Give it a try!
{fnum4fld("firstname"},{fnum4fld("lastname"}, etc.
Note that the sort() nColumn argument (Column number) starts from 0 for the first column. There is also some information about the sort() indexing here.
Also remember when you are manipulating a Grid Section with Lianja.getElementById() and synonyms, you need to work on the Section's embedded Grid object, e.g.
Code:oGrid = Lianja.get("page1.section1").grid
oGrid.sort(0,1) // sort ascending on the first column
Q:
A:Code:proc Gamelist_grdGameList_dblclick()
nRow=Lianja.Get("Gamelist.grdGameList").grid.activerow
messagebox(str(nRow2))
endproc
Code:proc Gamelist_grdGameList_dblclick()
oGrid = Lianja.Get("Gamelist.grdGameList").grid
nRow = oGrid.activerow
messagebox(str(nRow))
endproc
Q:
Is it possible to access a grid column heading through code?
For example, how do I determine the column heading for column 3?
A:
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.
Code:oCol1 = grid1.columns(1)
oHeader = oCol1.header1
oHeader.caption = "This is Column 1"
When you create a new grid object, make sure it is a 'mygrid' not a standard 'grid' or it will not have the colattribs() method defined.
needs to beCode:ui_goalhomecont.addobject("ui_goalhomegrid", "grid")
Code:ui_goalhomecont.addobject("ui_goalhomegrid", "mygrid")
Q:
How do I properly set this column to be read-only and have the grid functional?
A:
Code:oCol1 = ui_homegrid.columns(1)
oCol1.readonly = .T.
event that fires for a child grid as he moves through the parents. Parentdatachanged() fires before the new child is selected, so can't be used to pick up the child value (first row in child grid).
The click() firing has been confirmed as expected behaviour - it shouldn't fire if you are clicking within the same row.
Q:
A:Code:?Lianja.Get("test.section2").RowCount
?Lianja.Get("test.section2").item(1,2)
Reference the grid contained by the Grid Section:
Code:oGrid = Lianja.Get("test.section2").grid
? oGrid.rowcount
? oGrid.item(1,2)
To get information from the Grid, or select a cell:
Code:oGrid = Lianja.get("mypage.mysection").grid
// what is the value at row 3, column 4
? oGrid.item(3,4)
// what is the current row?
? oGrid.activerow
// what is the current column?
? oGrid.activecolumn
// select row 2, column 5
oGrid.activatecell(2,5)
Q:
Have a section "section1", as grid, there's a test table in it.
Another section "section2" as a canvas with a button on it.
Code in button: lianja.get("section1").grid.add
A:
The grid is bound to the test table so all you need to do is append/insert a record in the table issue a refresh on the grid then position onto the new row using ...grid.goto( recno() ).
All topics in [Answers] alphabetically: http://www.lianja.com/community/show...ll=1#post12352
This same topic is extended to another thread: http://www.lianja.com/community/show...Answers-Grid-2
...and another thread (dont ask why): http://www.lianja.com/community/show...Answers-Grid-3