Data Crid - set the dgNumberOfRecords

JB sundown at pacifier.com
Thu Apr 2 18:58:43 EDT 2015


Hi Pete,

Thank you very much for the reply and
all of the info!

I relay appreciate the help.  It sounds like
that is not the way to go.  I assume it will
also disable any checkboxes that were
added to the data grid.

thanks again,
John Balgenorth


On Apr 2, 2015, at 9:22 AM, Peter Haworth <pete at lcsql.com> wrote:

> The datagrid calls GetDataForLine every time it needs a line of data to put
> into the datagrid.  You will need to write a GetDataForLine handler in the
> datagrid's script to handle the logic for doing this.
> 
> Get DataFor Line includes a parameter that specifies the line number of the
> line needed.  If you are using a database cursor, use the line number to
> get hold of the database data for that line (actually, it's the line number
> - 1 since cursor record numbers are zero based), format it according to the
> datagrid columns, and put into the pdata parameter of the handler.
> 
> Be aware that using this method to populate the datagrid means that things
> like the dgText and dgData properties of the datagrid will return empty.
> If I remember correctly, you will also have to handle your own sorting when
> the user clicks on a column header.
> 
> It's not trivial and I would not recommend doing it unless you truly need
> to display a very large number of records in the datagird and you are
> experiencing performance issues.
> 
> Pete
> lcSQL Software <http://www.lcsql.com>
> Home of lcStackBrowser <http://www.lcsql.com/lcstackbrowser.html> and
> SQLiteAdmin <http://www.lcsql.com/sqliteadmin.html>
> 
> On Wed, Apr 1, 2015 at 8:16 PM, JB <sundown at pacifier.com> wrote:
> 
>> I am using a table form of data grid and trying
>> to display the records using a cursor and then
>> setting the dgNumberOfRecords.
>> 
>> I am able to get the cursor and the record count
>> of the cursor and I can get dgNumberOfRecords
>> before I set dgNumberOfRecords.
>> 
>> I want to set dgNumberOfRecords so the records
>> are displayed dynamically like is done in the sample
>> stack for displaying a large number of records.
>> 
>> Am I supposed to set up the GetDataForLine or the
>> dgNumberOfRecords in my data grid somehow?
>> 
>> When I set dgNumberOfRecords nothing else happens
>> and any script after that does not work either.
>> 
>> Anyone have a clue why it stops or a different stack that
>> shows how to use it properly?
>> 
>> John Balgenorth
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
> 





More information about the use-livecode mailing list