dojox/grid/enhanced/plugins/GridSource.js

  • Provides:

    • dojox.grid.enhanced.plugins.GridSource
  • Requires:

    • dojo.dnd.Source in common in project dojo
    • dojox.grid.enhanced.plugins.DnD in common
  • dojox.grid.enhanced.plugins.GridSource

    • type
      Function
    • chains:
      • dojo.dnd.Source: (prototype)
      • dojo.dnd.Source: (call)
    • summary
      A special source that can accept grid contents.
      Only for non-grid widgets or domNodes.
  • dojox.grid.enhanced.plugins.GridSource.accept

    • summary
  • dojox.grid.enhanced.plugins.GridSource.insertNodesForGrid

    • type
      If
    • summary
      you'd like to insert some sort of nodes into your dnd source, turn this on,
      and override getCellContent/getRowContent/getColumnContent
      to populate the dnd data in your desired format.
  • dojox.grid.enhanced.plugins.GridSource.markupFactory

    • type
      Function
    • parameters:
      • params: (typeof )
      • node: (typeof )
    • source: [view]
        return new dojox.grid.enhanced.plugins.GridSource(node, params);
    • summary
  • dojox.grid.enhanced.plugins.GridSource.checkAcceptance

    • type
      Function
    • parameters:
      • source: (typeof )
      • nodes: (typeof )
    • source: [view]
        if(source instanceof dojox.grid.enhanced.plugins.GridDnDSource){
         if(nodes[0]){
          var item = source.getItem(nodes[0].id);
          if(item && (dojo.indexOf(item.type, "grid/rows") >= 0 || dojo.indexOf(item.type, "grid/cells") >= 0) &&
           !source.dndPlugin._allDnDItemsLoaded()){
           return false;
          }
         }
         this.sourcePlugin = source.dndPlugin;
        }
        return this.inherited(arguments);
    • summary
  • dojox.grid.enhanced.plugins.GridSource.onDraggingOver

    • type
      Function
    • source: [view]
        if(this.sourcePlugin){
         this.sourcePlugin._isSource = true;
        }
    • summary
  • dojox.grid.enhanced.plugins.GridSource.onDraggingOut

    • type
      Function
    • source: [view]
        if(this.sourcePlugin){
         this.sourcePlugin._isSource = false;
        }
    • summary
  • dojox.grid.enhanced.plugins.GridSource.onDropExternal

    • type
      Function
    • parameters:
      • source: (typeof )
      • nodes: (typeof )
      • copy: (typeof )
    • source: [view]
        if(source instanceof dojox.grid.enhanced.plugins.GridDnDSource){
         var ranges = dojo.map(nodes, function(node){
          return source.getItem(node.id).data;
         });
         var item = source.getItem(nodes[0].id);
         var grid = item.dndPlugin.grid;
         var type = item.type[0];
         var range;
         try{
          switch(type){
           case "grid/cells":
            nodes[0].innerHTML = this.getCellContent(grid, ranges[0].min, ranges[0].max) || "";
            this.onDropGridCells(grid, ranges[0].min, ranges[0].max);
            break;
           case "grid/rows":
            range = _joinToArray(ranges);
            nodes[0].innerHTML = this.getRowContent(grid, range) || "";
            this.onDropGridRows(grid, range);
            break;
           case "grid/cols":
            range = _joinToArray(ranges);
            nodes[0].innerHTML = this.getColumnContent(grid, range) || "";
            this.onDropGridColumns(grid, range);
            break;
          }
          if(this.insertNodesForGrid){
           this.selectNone();
           this.insertNodes(true, [nodes[0]], this.before, this.current);
          }
          item.dndPlugin.onDragOut(!copy);
         }catch(e){
          console.warn("GridSource.onDropExternal() error:",e);
         }
        }else{
         this.inherited(arguments);
        }
    • summary
  • dojox.grid.enhanced.plugins.GridSource.getCellContent

    • type
      Function
    • parameters:
      • grid: (typeof )
      • leftTopCell: (typeof )
      • rightBottomCell: (typeof )
    • source: [view]
        // summary:
        //  Fill node innerHTML for dnd grid cells.
        // sample code:
        //  var cells = grid.layout.cells;
        //  var store = grid.store;
        //  var cache = grid._by_idx;
        //  var res = "Grid Cells from " + grid.id + ":
      ";
        //  for(var r = leftTopCell.row; r <= rightBottomCell.row; ++r){
        //   for(var c = leftTopCell.col; c <= rightBottomCell.col; ++c){
        //    res += store.getValue(cache[r].item, cells[c].field) + ", ";
        //   }
        //   res = res.substring(0, res.length - 2) + ";
      ";
        //  }
        //  return res;
    • summary
      Fill node innerHTML for dnd grid cells.
      sample code:
      var cells = grid.layout.cells;
      var store = grid.store;
      var cache = grid._by_idx;
      var res = &quot;Grid Cells from &quot; + grid.id + &quot;:&lt;br/&gt;&quot;;
      for(var r = leftTopCell.row; r &lt;= rightBottomCell.row; ++r){
      for(var c = leftTopCell.col; c &lt;= rightBottomCell.col; ++c){
      res += store.getValue(cache[r].item, cells[c].field) + &quot;, &quot;;
      }
      res = res.substring(0, res.length - 2) + &quot;;&lt;br/&gt;&quot;;
      }
      return res;
  • dojox.grid.enhanced.plugins.GridSource.getRowContent

    • type
      Function
    • parameters:
      • grid: (typeof )
      • rowIndexes: (typeof )
    • source: [view]
        // summary:
        //  Fill node innerHTML for dnd grid rows.
        // sample code:
        //  var cells = grid.layout.cells;
        //  var store = grid.store;
        //  var cache = grid._by_idx;
        //  var res = "Grid Rows from " + grid.id + ":
      ";
        //  for(var i = 0; i < rowIndexes.length; ++i){
        //   var r = rowIndexes[i];
        //   res += "Row " + r + ": ";
        //   for(var j = 0; j < cells.length; ++j){
        //    if(!cells[j].hidden){
        //     res += store.getValue(cache[r].item, cells[j].field) + ", ";
        //    }
        //   }
        //   res = res.substring(0, res.length - 2) + ";
      ";
        //  }
        //  return res;
    • summary
      Fill node innerHTML for dnd grid rows.
      sample code:
      var cells = grid.layout.cells;
      var store = grid.store;
      var cache = grid._by_idx;
      var res = &quot;Grid Rows from &quot; + grid.id + &quot;:&lt;br/&gt;&quot;;
      for(var i = 0; i &lt; rowIndexes.length; ++i){
      var r = rowIndexes[i];
      res += &quot;Row &quot; + r + &quot;: &quot;;
      for(var j = 0; j &lt; cells.length; ++j){
      if(!cells[j].hidden){
      res += store.getValue(cache[r].item, cells[j].field) + &quot;, &quot;;
      }
      }
      res = res.substring(0, res.length - 2) + &quot;;&lt;br/&gt;&quot;;
      }
      return res;
  • dojox.grid.enhanced.plugins.GridSource.getColumnContent

    • type
      Function
    • parameters:
      • grid: (typeof )
      • colIndexes: (typeof )
    • source: [view]
        // summary:
        //  Fill node innerHTML for dnd grid columns.
        // sample code:
        //  var cells = grid.layout.cells;
        //  var res = "Grid Columns from " + grid.id + ":";
        //  for(var i = 0; i < colIndexes.length; ++i){
        //   var c = colIndexes[i];
        //   res += (cells[c].name || cells[c].field) + ", ";
        //  }
        //  return res.substring(0, res.length - 2);
    • summary
      Fill node innerHTML for dnd grid columns.
      sample code:
      var cells = grid.layout.cells;
      var res = &quot;Grid Columns from &quot; + grid.id + &quot;:&quot;;
      for(var i = 0; i &lt; colIndexes.length; ++i){
      var c = colIndexes[i];
      res += (cells[c].name || cells[c].field) + &quot;, &quot;;
      }
      return res.substring(0, res.length - 2);
  • dojox.grid.enhanced.plugins.GridSource.onDropGridCells

    • type
      Function
    • parameters:
      • grid: (typeof )
      • leftTopCell: (typeof )
      • rightBottomCell: (typeof )
    • source: [view]
    • summary
  • dojox.grid.enhanced.plugins.GridSource.onDropGridRows

    • type
      Function
    • parameters:
      • grid: (typeof )
      • rowIndexes: (typeof )
    • source: [view]
    • summary
  • dojox.grid.enhanced.plugins.GridSource.onDropGridColumns

    • type
      Function
    • parameters:
      • grid: (typeof )
      • colIndexes: (typeof )
    • source: [view]
    • summary
  • dojox.grid.enhanced.plugins.GridSource.sourcePlugin

    • summary
  • dojox.grid.enhanced.plugins.GridSource.sourcePlugin._isSource

    • summary
  • dojox.grid.enhanced.plugins

    • type
      Object
    • summary
  • dojox.grid.enhanced

    • type
      Object
    • summary
  • dojox.grid

    • type
      Object
    • summary
  • dojox

    • type
      Object
    • summary