Forums
Custom button action on list data page - Printable Version

+- Forums (http://forum.masdeveloper.com)
+-- Forum: General (http://forum.masdeveloper.com/forumdisplay.php?fid=1)
+--- Forum: Appcore Custom Tutorial (http://forum.masdeveloper.com/forumdisplay.php?fid=12)
+--- Thread: Custom button action on list data page (/showthread.php?tid=22)



Custom button action on list data page - seegithub - 09-15-2015

hello, this time I want to share knowledge of how to customize action buttons that are on the list of data pages. See image below:
[Image: custombutton.png]



there appears there are two new buttons , namely cc and print , here's how to add a costume button.

1. First update helper file that I include in this forum. If there are changes that you have made on the file, please backed up first.
2. Extract zip file and put the file on the location: your_root_folder/application/helpers/
3. on the file view (list.php) around the line to add the 190 to 130 lines of code like this example :

PHP Code:
<?php
    if 
(isset($l->{$primaryKey})) {
 
       $uriView    = isset($viewUrl) ? "{$viewUrl}/{$l->$primaryKey}"#";
 
       $uriEdit    "{$editUrl}/{$l->$primaryKey}/{$offset}";
 
       $uriDel     "{$delUrl}/{$l->$primaryKey}/{$offset}";

 
       //create this custom button
 
       $btns['customBtn'] = array(
 
           array(
 
               'position' => 'behind',
 
               'template' => "<a target='_blank' href='http://www.google.co.id' class='btn btn-success btn-sm bs-tooltip' title='Print Invoice'><i class='fa fa-print'></i></a>"
 
           ),
 
           array(
 
               'position' => 'front',
 
               'template' => "<a href='javascript:void(0);' class='btn btn-success btn-sm bs-tooltip'><i class='fa fa-cc'></i></a>"
 
           )
 
       );

 
       //add $btns variabel on 4th domCrudActionButton() function
 
       echo domCrudActionButton($uriView$uriEdit$uriDel$btns);
 
   } else { ?>
        <i class="fa fa-warning font-size10"></i> <?php echo(Translator::__('Missing PK')); ?>
    <?php
    
}
?>

what options can be used in array ?
1. position
This option will put the key at the position in front or behind, the value of which can be used in this option is the 'front ' or ' behind '


2. templates
template is the html tag you want to use to create the button, in the example here I use a tag.


ok, see u on the next custom tutorial.



RE: Custom button action on list data page - Domidius - 05-09-2016

Can i watch my custom button but only for a specific module??


RE: Custom button action on list data page - seegithub - 05-14-2016

(05-09-2016, 05:24 PM)Domidius Wrote: Can i watch my custom button but only for a specific module??

Hello Domidius,

of course you can do it, but the first thing you should do is to separate the first view of the module you want to customize a button, and then you add a button to the view that you have separated earlier. How do I separate view on the customization module please see this video guide:
https://www.youtube.com/watch?v=EjcsF22vcZQ