function triggerVisibilityChange() {
      if (needsLayout && opts.syncWithLayout !== false) {
        grid.off(EVENT_LAYOUT_START, triggerVisibilityChange);
      }

      if (grid._hasListeners(startEvent)) {
        grid._emit(startEvent, targetItems.slice(0));
      }

      for (i = 0; i < targetItems.length; i++) {
        // Make sure the item is still in the original grid. There is a chance
        // that the item starts migrating before tiggerVisibilityChange is called.
        if (targetItems[i]._gridId !== grid._id) {
          if (--counter < 1) {
            if (isFunction(callback)) callback(completedItems.slice(0));
            if (grid._hasListeners(endEvent)) grid._emit(endEvent, completedItems.slice(0));
          }
          continue;
        }

        targetItems[i]._visibility[method](isInstant, function (interrupted, item) {
          // If the current item's animation was not interrupted add it to the
          // completedItems array.
          if (!interrupted) completedItems.push(item);

          // If all items have finished their animations call the callback
          // and emit showEnd/hideEnd event.
          if (--counter < 1) {
            if (isFunction(callback)) callback(completedItems.slice(0));
            if (grid._hasListeners(endEvent)) grid._emit(endEvent, completedItems.slice(0));
          }
        });
      }
    }
Show or hide Grid instance's items.

@private
@param {Item[]} items
@param {Boolean} toVisible
@param {Object} [options]
@param {Boolean} [options.instant=false]
@param {Boolean} [options.syncWithLayout=true]
@param {Function} [options.onFinish]
@param {(Boolean|Function|String)} [options.layout=true]