(1) Constructor for dv
Please note that the constructor you are using is deprecated:
Please
use:
Please do
not use:
Code: Select all
var dv = new AppGiniDetailView(); // DO NOT USE THIS
In the past that constructor sometimes lead to unexpected behaviour in cases in which programmers used copy&paste sample code and created multiple instances of AppGiniDetailView
for example in header-extras.php and in TABLENAME-tv.js and in TABLENAME-dv.js. To prevent consequential errors, the singleton AppGiniHelper.dv was introduced.
---
(2) addBadge() function
I have found a mistake in
my changelog: The
addBadge(number)
-function refers to
custom tabs, not children tabs. I'm sorry for my mistake and I have corrected it in code and website.
The following code works for (self-created)
custom tabs:
Code: Select all
// file: hooks/TABLENAME-dv.js
var dv = AppGiniHelper.dv;
var layout = dv.createLayout();
layout.add(1, ["#Order", "id", "number" /* more fields */ ]);
layout.add(2, ["#Customer", "customer_id" /* more fields*/ ]);
var tabOrder = dv.addTab("tabOrder", "Order", "shopping-cart", layout);
// ...more tabs
tabOrder.addBadge(123);
- chrome_DYcaJIxbml.png (18.09 KiB) Viewed 1805 times
---
(3) functions for children tabs
Lazy loaded elements (like children tabs) will not be available when the script has loaded nor on document-ready. Changes to them can be applied after the element has been (lazy) loaded. There is a function
dv.ready(fn)
in AppGini Helper Javascript Library which will wait for all lazy loading events and will then execute your code.
Example for changing the tab-caption of a child-tab:
Code: Select all
// file: hooks/TABLENAME-dv.js
var dv = AppGiniHelper.dv;
dv.ready(function() {
var tab_notes = dv.getChildrenTabs().get("notes");
tab_notes.label("Changed Tab Caption");
});
- chrome_wCVTuzfsZ4.png (6.54 KiB) Viewed 1805 times
Once again, I'm sorry for my mistake in changelog!