This event fires when an existing row is rendered, if the row has a Row Expander. If the function returns .t., the Expander icon is show. Otherwise, it is hidden.
This event allows you to hide the row expander icon for a row. For example, you can use this event to test if there would be any records to show in the Grid that appears in the Row Expander. If there are no records, you can hide the row expander icon.
ShowRowExpanderIcon = .t.
The following variables are available to you in the event:
The grid component definition
Data for the current row. For example, to get the value of the 'lastname' field: e.rowData.data("lastname")
In the case of a Grid based on a SQL database, a pointer to an open connection.
Your event must set these properties:
If .t., the row expander will be shown. If .f., the row expander will be hidden.
This example demonstrates how to show or hide the row expander icon for a Grid Component based on a DBF data source.
dim tbl2 as p tbl2 = table.open("invoices") dim i2 as p i2 = tbl2.query_create("","customerid = " + s_quote(e.rowData.data("customerId"))) if i2.records_get() = 0 then ShowRowExpanderIcon = .f. else ShowRowExpanderIcon = .t. end if
This example demonstrates how to show or hide the row expander icon for a Grid Component based on a SQL data source.
dim sqltxt as c dim args as sql::arguments sqltxt = "select count(*) from invoices where customerid = :arg1" args.add("arg1",e.rowData.data("customerid")) e.conn.execute(sqltxt,args) dim count as n count = e.rtc.cn.resultset.data(1) if count = 0 then ShowRowExpanderIcon = .f. else ShowRowExpanderIcon = .t. end if
You can also set state variables in this event. The value of any state variables will be available in all subsequent ajax callbacks (in the e.__si2 object).
To set a state variable:
e._state.myvar1 = "value1" e._state.myvar2 = "value2"