Page 1 of 1

Rename Text for addNew button

Posted: 2018-08-01 14:51
by olivier
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

Re: Rename Text for addNew button

Posted: 2018-08-01 15:38
by olivier
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 ...

Re: Rename Text for addNew button

Posted: 2018-08-01 21:43
by pbottcher
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');