HosipLan

Untitled

Jun 25th, 2011
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.  * Create helper for selecting rows in grid
  3.  */
  4. $('.grinder-toolbar').each(function () {
  5.     $(this).prepend(
  6.         $('<span>', {'class':'grinder-toolbar-action grinder-row-checker'}).append(
  7.             $('<button>', {'class':'button'}).append(
  8.                 $('<input>', {'type':'checkbox'})
  9.                     .css({'margin':'0px','padding':'0px'})
  10.                     .change(function () {
  11.                         var $grid = $(this).closest('.grid');
  12.                         var $gridBoxes = $grid.find('input.grinder-row-check[type=checkbox]');
  13.                         var $gridCheckers = $grid.find('.grinder-toolbar .grinder-row-checker input[type=checkbox]');
  14.  
  15.                         if (this.checked == true) {
  16.                             $gridBoxes.attr('checked', true);
  17.                             $gridCheckers.attr('checked', true);
  18.                         } else {
  19.                             $gridBoxes.attr('checked', false);
  20.                             $gridCheckers.attr('checked', false);
  21.                         }
  22.                     })
  23.             )
  24.         )
  25.     );
  26. });
Advertisement
Add Comment
Please, Sign In to add comment