Infragistics UltraGrid - How can I test if there is an activ

Posted by MGreenwood on 15-Nov-2010 07:22

Hi,

We are running under OE 10.2.

We have a grid and we have some tabs.

When we move through the rows we test the row data to see if we need to get new data for the tab i.e.

lvdtCurrDepartDate = GridSpecialOffers:ActiveRow:cells:Item["departure-dt"]:value.

IF lvdtSavedDate NE lvdtCurrDepartDate THEN ...

This works fine and queries are run when the date changes.

BUT

When we drag a column header to group by the column, according to the symbolic debugger, the line above generates an error

Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)

We are assuming this is because we no longer have an active row because the grouping hides the rows. We have looked in the infragistics KB and Forums to try and find some way of setting the active row. In the InitializeRowsCollection method of the grid we have unsuccessfully attempted to set the active row to be the first row. e.g.

GridSpecialOffers:ActiveRow = GridSpecialOffers:ActiveRowScrollRegion:FirstRow.

GridSpecialOffers:Rows:Item[0]:Selected = TRUE.

GridSpecialOffers:ActiveRow = GridSpecialOffers:Rows[0].

Does anyone know how this can be achieved in Progress?

All Replies

Posted by Peter Judge on 15-Nov-2010 07:56

mgreenwood@calsoftware.co.uk wrote:

Hi,

We are running under OE 10.2.

We have a grid and we have some tabs.

When we move through the rows we test the row data to see if we need to get new data for the tab i.e.

lvdtCurrDepartDate = GridSpecialOffers:ActiveRow:cells:Item["departure-dt"]:value.

IF lvdtSavedDate NE lvdtCurrDepartDate THEN ...

This works fine and queries are run when the date changes.

BUT

When we drag a column header to group by the column, according to the symbolic debugger, the line above generates an error

Lead attributes in a chained-attribute expression (a:b:c) must be type HANDLE or a user-defined type and valid (not UNKNOWN). (10068)

We are assuming this is because we no longer have an active row because the grouping hides the rows. We have looked in the infragistics KB and Forums to try and find some way of setting the active row. In the InitializeRowsCollection method of the grid we have unsuccessfully attempted to set the active row to be the first row. e.g.

GridSpecialOffers:ActiveRow = GridSpecialOffers:ActiveRowScrollRegion:FirstRow.

GridSpecialOffers:Rows:Item[0]:Selected = TRUE.

GridSpecialOffers:ActiveRow = GridSpecialOffers:Rows[0].

Does anyone know how this can be achieved in Progress?

You also could try , but your code above should work. What's failing?

Grid:Rows:Item[0]:Activate().

I'd also make sure that the queries are in sync (in terms of sorting at the very least) with the UI. You may need to enable external sorting via the HeaderClickAction property, so that you can reopen the query to match the UI. Repositioning one the query's open should also make make the row active.

-- peter

Posted by MGreenwood on 15-Nov-2010 09:30

Hi Peter,

Thanks for the suggestion. Sadly the error still appears when applying your suggestion.

pjudge wrote:

I'd also make sure that the queries are in sync

We believe (though this is based on limited experience of infragistics) that this is related to the grid and not the data. If the user selects a row and for example the date changes we go and get data related to the new date.

pjudge wrote:

... What's failing?

I don't know how to explain it better;

We build data, the grid is populated - No Errors.

The event Grid_AfterRowActivate fires and code to populate the "supplementary data" is called, this finds out what tab a user is on and if the date has changed fetches the relevant data - No Error

The ERROR occurrs when we perform a "Group By" action by dragging a column header and, among  the events that fire are, Grid_InitializeRowsCollection where we are attempting to assign the active row,  then Grid_AfterRowActivate where code to populate the "supplementary data" is called the line containing the assignment Grid:ActiveRow:cells:Item["departure-dt"]:value is reached.

Perhaps we are trying to set the active row at the wrong place, perhaps we are misusing the construct Grid:ActiveRow...value, perhaps we should try solving this a different way ? I don't know but after a day of banging my head against this I have a sore head !

Posted by Tung on 26-Jan-2012 05:07

After repositioning a binding source's query to my desired record, I do this to make it the selected row in the grid.

                bsLookup:Refresh().
                grLookup:Selected:Rows:Clear().
                grLookup:Selected:Rows:Add(grLookup:Rows:Item[bsLookup:Position]).
                grLookup:ActiveRowScrollRegion:ScrollRowIntoView(grLookup:Selected:Rows:Item[0]).

It clears any selected rows, selects the repositioned row then brings it into view, and because a selected row is an active row it triggers the AfterRowActivate event.

This thread is closed