Custom toolbar button text gets repeated display on every search

QuestionsCustom toolbar button text gets repeated display on every search
Danish Zafar asked 2 years ago

I am using the following for custom button on toolbar, but whenever any search is performed in the grid (be it text or selector) the button gets duplicated with the text on every search, kindly refer the attached screenshot

View post on imgur.com

 

demos/appearance/toolbar-button.php

$grid[“loadComplete”] = “function(){ addButton(); }”;

// adds a button on top right of toolbar
function addButton()
{
setTimeout( ()=> {

jQuery(‘#list1_filtersearch’).before(“<button style=’margin-top:-5px; border-color: transparent;’ id=’list1_circle’ type=’button’>xxx</button>”);
jQuery(“#list1_circle”).uibutton({ icons: { primary: “ui-icon-bars fa fa-circle” },text: false }).click(function ()
{
alert(‘circle’);
return false;
});

}, 200);

 

 

Kindly advise

Thanks !

2 Answers
Abu Ghufran Staff answered 2 years ago

I’ve updated the demo to solve this. Moved it from loadComplete to document ready event.

Refer this code demo:

https://www.gridphp.com/demo/demos/appearance/toolbar-button.php

and code:

https://www.gridphp.com/demo/demos/appearance/toolbar-button.phps

_________________________
Abu Ghufran - Dev Team
Grid 4 PHP Framework
 
Danish Zafar answered 2 years ago

Thanks, its working fine now 🙂

Your Answer

8 + 7 =

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 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

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

Let us improve this post!

Tell us how we can improve this post?