Skip to content

Commit

Permalink
Dev: Add support for custom action in massive action widget
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Sep 22, 2016
1 parent 62e5261 commit 12b7f47
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Expand Up @@ -64,13 +64,19 @@ $(document).on('click', '.listActions a', function ()
}

// Set window location href. Used by download files in responses list view.
if (actionType == 'window-location-href')
{
if (actionType == 'window-location-href') {
var $oCheckedItems = $.fn.yiiGridView.getChecked($gridid, $('.listActions').data('pk')); // So we can join
window.location.href = $actionUrl + $oCheckedItems.join(',');
return;
}

if (actionType == 'custom') {
var js = $that.data('custom-js');
console.log('js', js);
var func = eval(js);
func();
}

// TODO: switch case "Modal"
var $modal = $('#'+$that.data('modal-id')); // massive-actions-modal-<?php $aAction['action'];?>-<?php echo $key; ?>

Expand Down
Expand Up @@ -43,6 +43,9 @@
<?php if (isset($aAction['on-success'])): ?>
data-on-success="<?php echo $aAction['on-success'];?>"
<?php endif; ?>
<?php if (isset($aAction['custom-js'])): ?>
data-custom-js="<?php echo $aAction['custom-js'];?>"
<?php endif; ?>
data-action="<?php echo $aAction['action'];?>"
data-type="<?php echo $aAction['actionType']; //Direct action, or modal ?>"
data-grid-reload="<?php if(isset($aAction['grid-reload'])){echo $aAction['grid-reload'];}else{echo "no";}?>"
Expand Down

0 comments on commit 12b7f47

Please sign in to comment.