Page 1 of 1

Metadata in tabs?

Posted: 2023-01-27 02:13
by dge
Code examples from the appginiHelper website indicate it's possible to show Metadata in a tab but I can't get it to work. Using the latest appgini (22.14) and latest appgini helper version, I can create a tab called Metadata but it won't show anything in that tab (though my other tabs work fine). It would be very useful to be able to see the creator, modifier and modification date like the examples show!

This is my code:
var dv = AppGiniHelper.DV;
dv.compact();

dv.getField("quantity").size(100);
dv.getField("displayOrder").size(70);
dv.getField("priceCharged").size(100);
dv.getField("quantityShipped").size(150);

var row_1 = dv.addLayout([2,8,2])
.add(1, ["prodPhoto","displayOrder", "backorder","odHide"])
.add(2, ["productFamily", "productType", "prodID", "custom", "odDescription", "productNote", "odNotes"])
.add(3, ["quantity", "listPrice", "copyFunction", "priceCharged", "unitsInStock", "quantityShipped" ])
.wrapLabels();

var row_2 = dv.addLayout([6,6])
.add(1, ["invoiceDate", "orderID", "productBOMKey"])
.add(2, ["invoiceNumber","extPrice", "odID"])
.wrapLabels();

var tab1 = dv.addTab( "Item Info", "Item Info", "Item Info" )
.add(row_1);

var tab2 = dv.addTab( "Utility", "Utility", "Utility")
.add(row_2);

var tab3 = dv.addTab( "meta-tab", "Metadata", "cog" )
.add(["created_by", "modified_by", "modified_on"]);

dv.getTabs().setPosition(TabPosition.Bottom);

The Item Info and Utility tabs contents work as expected but the Metadata tab is empty, it shows nothing.
The console shows these errors: AppGiniHelper Field not found: #created_by, and also Field not found for #modified_by and #modified_on

My code is based on the examples found here: https://appgini.bizzworxx.de/products/j ... view/tabs/
It would be very useful to be able to see the metadata. What am I doing wrong?

Image

Re: Metadata in tabs?

Posted: 2023-01-27 07:22
by jsetzer
The console shows these errors: AppGiniHelper Field not found: #created_by, and also Field not found for #modified_by and #modified_on
The error messages exactly tell us that your table does not have those fields.


---

This tab you have seen is just a normal custom tab, labelled "Meta" (or "Metadata" if you like). Just create it as always and insert your table's fields, for example id, created_by, created_on etc.. nothing special. Ensure your table contains the fields/fieldnames you are using here.

Remember:
This is a (clientside) Javascript Library. We can only show data we already have on clientside.

The library does not fetch any additional schema information from the database nor from additional membership_* tables nor from any serverside APIs. If you need additional data on clientside you have to fetch that data using AJAX, for example.

Tip
I got used to create the following fields on all tables:
  • id (obviously)
  • created_on
  • created_by
  • modified_on
  • modified_by
This makes it easy for me to kind of auto create a tabMeta in all DVs. The function for creating that tab is in header-extras, so I don't even have to write such code in every DV.

So, sorry, nothing fancy out of the box but just well known AGH Javascript Library functions for custom tabs.

Docs for custom tabs
http://www.appgini.de/docs/Javascript-L ... index.html

Re: Metadata in tabs?

Posted: 2023-01-27 17:43
by dge
Thanks Jan! Makes perfect sense, somehow I was under the impression it was able to (magically) access the membership tables, but of course javascript can't do that. Maybe adding a little note into the your documentation to remind people of that would be helpful as well.