Custom button on toolbar

QuestionsCustom button on toolbar
Davy asked 6 years ago

Hello,

I followed the info on changing normal buttons on the toolbar to custom ones… Unfortunately, the jQuery code shown in the example is NOT adding a button to my toolbar. So at the moment, there is no button anymore as I hide them (but re-add with jQuery).

Any help ?

Greetings,

Davy

3 Answers
Abu Ghufran answered 6 years ago

Try adding custom button in grid load event.

php config:

$e["js_on_load_complete"] = "grid_onload";
$grid->set_events($e);

html part:

<script>
function grid_onload(id)
{
// try button add code here
}
</script>

Refer toolbar-button.php for custom button code.

Davy answered 6 years ago

Abu,

I will give that a try.
The way I was trying to do it, is with the information in the help section !

<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('#list1').jqGrid('navButtonAdd', '#list1_pager',
{
'caption' : '',
'buttonicon' : 'ui-icon-pencil',
'onClickButton': function()
{
// your custom JS code …
function redireciona() {window.location="cadastrar.php";}
redireciona();
},
'position': 'first'
});
});
</script>

Greetings,

Davy

Davy answered 6 years ago

Abu,

I'm sorry if I'm sounding stupid, but where can I see the real code of the examples ?
If I go to the features tour page, I can look at the Source of the page, but can not see the internals of the example…

Is there an example package to download ?

As I'm quit new to PHP, I have no idea what to put inside the SCRIPT part of your example above ?

————–
$e["js_on_load_complete"] = "grid_onload";
$grid->set_events($e);

html part:

<script>
function grid_onload(id)
{
// try button add code here ???????
}
</script>
————–

Greetings,

Davy

Your Answer

15 + 13 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating / 5. Vote count:

We are sorry that this post was not useful for you!

Let us improve this post!