Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > JavaScript API > Examples

How to hide 'Edit selected'/'Delete selected' buttons

Scroll Prev Next More

 

Sometimes you need to show the Edit selected and Delete selected buttons only when users select records on the List page. For this purpose, add the following code to the List page: JavaScript OnLoad event:

 

var $editSelected = $('#edit_selected' + pageid),
  $deleteSelected = $('#delete_selected' + pageid);
$editSelected.hide();
$deleteSelected.hide();
 
$('input[type=checkbox][name=^selection], #select_all' + pageid +', #chooseAll_' + pageid).change( function(e) {
  var $target = $(e.target),
       selBoxes;
 
  if ( $target.attr('name') == 'selection[]' || $target.attr('id') == 'chooseAll_' + pageid ) {
    selBoxes = pageObj.getSelBoxes( pageid );
    $editSelected.toggle( selBoxes.length > 0 );
      $deleteSelected.toggle( selBoxes.length > 0 );
 }
});

See also:

JavaScript API: Control object > hide()

JavaScript API: Control object

Events: JavaScript OnLoad

JavaScript API