Rename Text for addNew button

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
olivier
Posts: 5
Joined: 2016-10-21 19:47

Rename Text for addNew button

Post by olivier » 2018-08-01 14:51

Hello,

I would like to rename the texts for the addNew button, but not for all tables (this can be done in language.php) but only for one given table.

I tried to modify if in the table hook file in function xxx_footer , but I don't have a clue about the syntax :

<script>$j(function(){
$j('#addNew')??????????? = my new text to display on the button
})</script>

I also tried in different files using a new variable ($Translation['Add New Msg M'] = 'Create new Message'; ) and modifying the tablename_dml.php file using

$templateCode = str_replace("<%%ADDNEW({$ptfc[0]})%%>", '<button type="button" class="btn btn-success add_new_parent hspacer-md" id="' . $ptfc[0] . '_add_new" title="' . html_attr($Translation['Add New Msg M'] . ' ' . $ptfc[1]) . '"><i class="glyphicon glyphicon-plus-sign"></i></button>', $templateCode);

but it won't work either ...

Any idea ?

Thanls a lot,
Best

olivier
Posts: 5
Joined: 2016-10-21 19:47

Re: Rename Text for addNew button

Post by olivier » 2018-08-01 15:38

I quickly tested writing $j('#addNew').text("my new title");
It works well on a large screen, but when resizing the screen in smaller sizes, my text is replaced with the original text defined in languages.php ... so the problem still exists ...

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts: 1635
Joined: 2018-04-01 10:12

Re: Rename Text for addNew button

Post by pbottcher » 2018-08-01 21:43

Hi,

you can try this:

Code: Select all

$j('.btn-success').find('#addNew').prevObject[0].lastChild.data=" MyText";
$j('.btn-success').find('#addNew').prevObject[1].lastChild.data=" MyText";

this will retain the glyphicon if you want.

Otherwise you can do it via

Code: Select all

$j('.btn-success').text('MyText');
Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

Post Reply