Quickie: Insert heading above (children-) tabs

Just a short script-fragment. A customer asked for a heading above children tabs. There is not much to do, and nothing complicated. Just add the following code to your hooks/TABLENAME-dv.js file and change the text between <h1> and </h1>.

Code

// file: hooks/TABLENAME-dv.js
$j(".children-tabs").parent().prepend("<h1>Dependent Records</h1>");

Result

Tip: do not insert headline in insert-mode

If you do not want to see it in insert-mode, just check if we are in insert-mode or not.

Using our AppGini Helper Javascript Library there is a useful function isInsert() for this:

var dv = AppGiniHelper.DV;

if (!dv.isInsert()) {
  $j(".children-tabs").parent().prepend("<h1>Dependent Records</h1>");
}

Note the exclamation mark "!" right before dv.isInsert() function call: The exclamation mark means logical not. If it is more readable and understandable for you, you can write the same code like this instead:

var dv = AppGiniHelper.DV;
var insert_mode = dv.isInsert();
if (insert_mode == false) {
  $j(".children-tabs").parent().prepend("<h1>Dependent Records</h1>");
}

Do you like it?