How to add the user defined button at the top toolbar

QuestionsHow to add the user defined button at the top toolbar
Steve asked 2 weeks ago

+ Review, Search,  Requery, etc. buttons image

 

I want to add new button to toolbar of php grid.  and link to the user defined function.

How can I do for this?

 

 

 

3 Answers
Steve answered 2 weeks ago

$g>set_actions(array(

“add”=>true, // allow/disallowadd

“edit”=>true, // allow/disallow edit

delete”=>true, // allow/disallow delete

rowactions=>true, // show/hide row wise edit/del/save option

search => “advance” // show single/multi field search condition (e.g. simple or advance) ) );

 

Abu answered 2 weeks ago

Refer demos/appearance/toolbar-button.php for adding custom button.

Steve answered 2 weeks ago

Thank you for your answer to me.

 

I want to use the below function with the user-defined button.

 

jQuery(document).ready(function(){

jQuery(‘#list1’).jqGrid(‘navButtonAdd’, ‘#list1_pager’,
{
‘id’ : ‘Update Calendar’,
‘caption’ : ‘Update Calendar’,
‘buttonicon’ : ‘ui-icon-save’,
‘onClickButton’ : function()
{

 

// how to code to use the below function

},
‘position’: ‘last’
});

 

// Is this function right ???  I think it doesn’t  work at all.  where should I change?

function update_master($data)
{
// you can also use grid object to execute sql, useful in non-mysql driver

global $grid;

$str = “update DPLSchedule as m
set UpCN51 = (select count(HHT) from DPLmigration as d where d.pid=m.id and d.MgStatus = ‘SUCCESS’ AND d.HHT = ‘CN51’),
UpCT40 = (select count(HHT) from DPLmigration as d where d.pid=m.id and d.MgStatus = ‘SUCCESS’ AND d.HHT = ‘CT40’)
where m.id = {$data[“pid”]}”;

$grid->execute_query($str);
}

Your Answer

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

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

Let us improve this post!