Ok, that worked quite well, I made following 2 functions

$.fn.block_row = function(opts) {
  row = $(this)
  height = row.height();
  $('td, th', row).each(function() {
    cell = $(this);
    //$('input', cell).hide().addClass('hiddenInputByBlock');
    cell.wrapInner('<div class="holderByBlock container" style="width:
100%; height: ' + height + 'px; overflow: hidden;"></div>');
    cell.addClass('cleanByBlock');
    cell.attr('style', 'border: 0; padding: 0;')
    $('div.holderByBlock', cell).block();
  })
};

$.fn.unblock_row = function(opts) {
  row = $(this)
  $('.cleanByBlock', row).each(function() {
    cell = $(this);
    $('div.holderByBlock', cell).unblock({
      onUnblock: function(cell, opts) {
        this_cell = $(cell).parent('td, th');
        //$('input.hiddenInputByBlock',
this_cell).show().removeClass('hiddenInputByBlock');
        this_cell.html($('.holderByBlock', this_cell).html());
        this_cell.removeAttr('style');
        this_cell.removeClass('cleanByBlock');
      }
    });
  })
};

However I now have a second problem.
Two of my table cells contain checkboxes that have "click" events
enabled on them (the click events gets set by a JS function that is
called on document load.

When I click a checkbox these steps happen:
- Block parent row
- send ajax request
- when ajax request is finished unblock row

However, after the unlock, the checkboxes no longer work (the click
event has gone).

I could re attach them, but then these methods wouldn't be reusable at
all.

On Oct 10, 1:05 pm, Mike Alsup <[EMAIL PROTECTED]> wrote:
> Blocking table cells may work in some browsers but in won't work
> reliably in an x-browser environment.  The blocked element needs to be
> an element that can have a relative position, and that is not true of
> TRs and TDs.  Further, the "block" overlay (a div) is appended to the
> blocked element, and appending a div to a table is not valid.  If you
> need to block a table, wrap it in a div and block that div instead.
> If you need to block a table cell, wrap the cell contents in a div and
> block that div instead.  If you need to block a row, block each TD's
> content div.  For example:
>
> // block 3rd row
> $('tr:eq(2) td div.cellContent').block();
>
> Mike
>
> On Oct 10, 6:37 am, Bertg <[EMAIL PROTECTED]> wrote:
>
> > When trying to block a row (tr), cell (td) or an entire table using
> > blockui the entire window gets blocked.
>
> > eg: $('table tr:first').block();
>
> > Anyone have a patch laying around to get that behaviour working or is
> > interested in creating that functionality, cause my JS knowledge isn't
> > that advanced yet.
>
> > I'm using blockui 2.09 .

Reply via email to