Dynamically Set the height of DataGrid

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Dec 10 12:59:39 EST 2018

Well I got as far as 

On mouseup

# get data need for the datagrid then

put sMap[portalData][tTarget][rowdata] into tRowdataA
reSizeDataGrid (item 2 of extents(tRowdataA) )
set dgData of grp "navMap"  to tRowdataA

End mouseups

command reSizeDataGrid pNumOfRows #dgText array is set the datagrid
   set the height of group "navMap" of me to ( (67*pNumOfRows) )
   set top of group "navMap" of me to 100
end reSizeDataGrid

But I have to hard card it...you methods are better.

1) question a hierarchy? The command that we want to use to customize (dgprops gives everything!). are they better "externalized" the Datagrid before showing it...OR in better to encapsulate in the behavior script  of the DG itself. Say, in the "LayoutControl" handler.

Of course you are going to say. "Depends on your context, if you want new one to have the same customization... better make it external."   

But then those of you have done this a while have a preferred "best" practice.. What is it?

2) Now, if I could just do a proper "Refresh" 
...nothing I will do in the current RowTemplate affects the datagrid...."argh". which take all it color from Item Inspector of the datagrid as a whole... it as if the "mask" that the rowtemplate is not being rendering. Just the "elements" but not the colors and size


On 12/10/18, 5:45 AM, "use-livecode on behalf of Bob Sneidar via use-livecode" <use-livecode-bounces at lists.runrev.com on behalf of use-livecode at lists.runrev.com> wrote:

        get the dgNumberOfRecords
        set the dgNumberOfRecords of group "DataGrid" to 20
        Getting the dgNumberOfRecords is the same as getting the dgNumberOfLines. Setting the dgNumberOfRecords has a special significance however. If you set the dgNumberOfRecords then you are telling the data grid that you know how many total records there are and you are going to supply the data for each record on an as-needed basis. This is useful when you have data in a database cursor that you would like to feed into the data grid.
    row height
    - For tables and forms whose 'fixed row height' property is true this represents the height that your rows will be drawn at. If this property is not set for a form whose 'fixed control height' is true then the record template group height is used. For forms whose 'fixed control height' is false this represents the height that alternating rows that contain no data will be drawn at.
    So something like:
    put the dgNumberOfRecords of group "DataGrid" into tNumberOfRecords
    put the dgProp ["row height"] of group "DataGrid" into tRowHeight
    Set the height of group "DataGrid" to min(12, tNumberOfRecords) * (tRowHeight) + 36 -- account for header and scrollbar
    Bob S

More information about the Use-livecode mailing list