Hello There, Guest! Login Register


Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Custom button action on list data page
#1
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.


Attached Files
.zip   hdom_helper.zip (Size: 5.42 KB / Downloads: 11)
Reply
#2
Can i watch my custom button but only for a specific module??
Reply
#3
(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
Reply


Forum Jump:


Users browsing this thread:
1 Guest(s)