1

I created a simple RME for TTeeGrid, a descendant perhaps of TGrid in Firemonkey. As shown below, the data are displayed at design time but not at runtime except the headers.

enter image description here

I've been breaking my head over this for weeks already but not luck.

Let me know if you need more details but what you see in the image are all you get.

I just need help to have the data displayed at runtime as shown in the design time.

UPDATE 1

This issue is not the case with TPrototypeBindSource. The data shown in the design time are displayed at runtime. Something is wrong somewhere.

RickyBelmont
  • 619
  • 4
  • 11
  • 1
    If it is a TGrid descendant, try creating a couple of columns to it, add a TPrototypeBindSource, add a couple of FieldDefs to that, then right-click the **grid** and select `LiveBindings Wizard`. If you accept the default action and click Finish, the wizard should then populate the grid. After that, you can then replace the TPrototypeBindSource by a DataSource referencing the data you actually want to use. – MartynA Jul 16 '20 at 07:08
  • Thank you @MartynA. As suggested, I tried the TPrototypeBindSource and it works! However, with the Rest source of data I am surprised why it is not working. By the way, I have to inform here that the fields are dynamic, it can increase depending on the user case. But this is not my issue right now. It is the data not displaying using Rest components. – RickyBelmont Jul 16 '20 at 07:52

1 Answers1

2

I've never used the TeeGrid before, but the following worked fine first time for me in Delphi Tokyo:

  1. Download the TeeGrid trial from Steema.Com & install.

  2. Create new multi-device app and place a TeeGrid and a FDMemTable on the form.

  3. Load FDMemTable1 with the file Parts.Fds from the Delphi samples Data directory. Note, I did not then create any FieldDefs as I mentioned in my comment earlier as what I'm describing works without them.

  4. Set the DataSource property of TeeGrid1 to FDMemTable1. TeeGrid1 immediately creates columns for each of the Parts fields and populates them with data - see screenshot below. I don't ordinarily include screenshots but in this case thought I would as what I got was so clearly at odds with what you've reported.

Your TeeGrid etc are obviously more complicated than mine. so the best I can suggest is that you backtrack to step 2 and see if you can replicate my result with your data (either at design time or run time). It might be worth loading your FDMemTable with some data at design time, as my impression is that live bindings is less grief-prone when the datasource has some data.

Incidentally, fwiw the results of my own attempts to set up live bindings even with a regular TGrid have been rather patchy, until I discovered that instead of messing with the LB components myself, simply starting with a fresh TGrid, right-clicking on it and leaving the Live Bindings Wizard to do its stuff consistently works fine.

enter image description here

MartynA
  • 30,454
  • 4
  • 32
  • 73
  • Thanks for this but as mentioned in my comment earlier that using sample data it works perfectly. With regards to LB, I am not sure I need that because the number columns may increase or can be determined only at runtime. Setting the datasource property of TeeGrid to FDMemtable can be useful to me because of its dynamic columns dataset. My just only issue here is that at runtime, it does not display the data in the TeeGrid. – RickyBelmont Jul 16 '20 at 12:57
  • On the other hand, to check if the TTeeGrid component is causing the issue. I tried the TGrid of firemonkey using LB, I get the same issue. The data is displaying at design time but not in runtime. – RickyBelmont Jul 16 '20 at 12:59
  • The same issue with TStringGrid. I supposed there must be something I should do with FDMemtable at runtime. Already tried teegrid.enable:=true and fdmemtable.active:=true at form oncreate but not luck. – RickyBelmont Jul 16 '20 at 13:10
  • At last! I got it! It is the RestRequest that I should execute at runtime to be able to get the data displayed. I overlooked this because I already executed the data at designtime. Didn't realize that I still need to re-execute at runtime. Oh my goodness! It took me a while to realize this! Anyway, thanks so much for the help. I really appreciate that. – RickyBelmont Jul 16 '20 at 13:14
  • 1
    Glad you finally got to the bottom of it. Anyway, it would be good if you accept this answer since it at least eliminated the live-binding of the FDMemTable to the TeeGrid as being the cause of the problem. – MartynA Jul 16 '20 at 13:18