I have copied this from the examples and on the whole it works very well. The issue I have is that when there are no results for the search I get the following exception:
Uncaught TypeError: Cannot read properties of undefined (reading 'Id')
at Object.GetPropValue (XData.Web.JsonDataset.pas:155)
at Object.GetJSONDataForField (XData.Web.JsonDataset.pas:116)
at Object.GetJSONDataForField$1 (jsondataset.pas:997)
at Object.GetFieldData$1 (jsondataset.pas:1693)
at Object.GetFieldData (db.pas:3892)
at Object.GetData (db.pas:5577)
at Object.GetValue (db.pas:6252)
at Object.GetAsString (db.pas:6221)
at Object.$impl.FieldToCellData (WEBLib.DBCtrls.pas:766)
at Object.LoadRow (WEBLib.DBCtrls.pas:2931)
Any ideas where to start looking to head this off?
@wlandgraf I have tracked this down further. The issue is not being raised in the plugin but in the TWebDBTableControl.
When the Plugin calls EnableControls various events fire on TWebDBTableControl. The key one is procedure TDBTableControl.RecordChange(Sender: TObject);
r := FDataLink.DataSource.DataSet.RecNo - 1; //set r = -1
if RowHeader then
inc(r); //sets r = 0
so the call is then LoadRow(0)
the problem is then raised in
if Assigned(lField) then
cd := FieldToCellData(ce, lField, Columns[c].DataType, false);
but I was so far down the step through rabbit hole by then that I''m not completely sure.
Here's the flow:
XData.Web.JsonDataset.pas:155
Uncaught TypeError: Cannot read properties of undefined (reading 'Id')
at Object.GetPropValue (XData.Web.JsonDataset.pas:155)
at Object.GetJSONDataForField (XData.Web.JsonDataset.pas:116)
at Object.GetJSONDataForField$1 (jsondataset.pas:997)
at Object.GetFieldData$1 (jsondataset.pas:1693)
at Object.GetFieldData (db.pas:3892)
at Object.GetData (db.pas:5577)
at Object.GetValue (db.pas:6252)
at Object.GetAsString (db.pas:6221)
at Object.$impl.FieldToCellData (WEBLib.DBCtrls.pas:766)
at Object.LoadRow (WEBLib.DBCtrls.pas:2931)
A little bit more info - if the first search you do returns 0 records then it is fine and continues to be fine if subsequent searches return 0 records. It is only if you do a 0 result search AFTER you do a search that returns a a result.
there is an issue with the music demo, which is not quite as extreme, but probably has the same source. If you search for something that isn't there then the last result remains visible, while the pagination displays 'showing record 0 of 0'. In this case the tablecontrol should be empty - which I would think is the way it would be designed.