![]() | Steema Issues DatabaseNote: This database is for bugs and wishes only. For technical support help, if you are a customer please visit our online forums;otherwise you can use StackOverflow. Before using this bug-tracker we recommend a look at this document, Steema Bug Fixing Policy. |
| Summary: | Problem that TVirtualDBData.Load raises error Selected Row must be >= -1 on a filtered dataset | ||
|---|---|---|---|
| Product: | TeeGrid for Delphi | Reporter: | Zlatko Kropf <swdevel> |
| Component: | Grid | Assignee: | david berneda <david> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | ||
| Priority: | --- | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows | ||
| Chart Series: | --- | Delphi / C++ Builder RAD IDE Version: | |
Fixed |
Environment: I am using Spring4d to hold/manipulate data and represent it as dataset using Spring.Data.ObjectDataSet. TObjectDataSet is a descendant of TDataSet and can hold data in an iList. On a sample form I have a grid, data is linked from the TObjectDataset. Everything works fine until I put a OnFilterRecord method on my data which filters the data. If any data passes the filter the grid displays it normally. However, when no records conform to criteria (the dataset is empty) then an exception is raised stating, "Error: Selected Row must be >= -1". I have traced the error to unit Tee.Grid.Selecton (row 506) - Assert(Value>=-1,'Error: Selected Row must be >= -1'); But the cause originates elsewhere: unit Tee.GridData.DB; Method procedure TVirtualDBData.Load(const AColumns:TColumns); if IDataSet<>nil then begin TryRelinkFields; if KnownCount then // Returns True ChangeSelectedRow(DataSetRecNo-1) // DataSetRecNo returns -1 --> calls ChangeSelectedRow(-2) else if Empty then ChangeSelectedRow(-1) else ChangeSelectedRow(0); end; When OnFilterRecord returns no records the call to ChangeSelectedRow wants to set the selected row to -2, causing the exception.