Opened 9 years ago

Closed 7 years ago

#10871 closed enhancement (wontfix)

Allow to set the position of the indirect selection

Reported by: thisconnect Owned by: Evan
Priority: high Milestone: 1.9
Component: DojoX Grid Version: 1.4.2
Keywords: Cc:
Blocked By: Blocking:

Description

Right now i need to apply a dirty hack to set the position of the indirect selection is it possible to add a param so you can define the position of the selection?

This is the dirty hack i apply

dojo.extend(dojox.grid.enhanced.plugins.IndirectSelection,
    {
      addRowSelectCell: function(){
        //summary:
        //    Add the indirect selection cell(mapped to a column of checkboxes) to grid layout structure
        if(!this.grid.indirectSelection || this.grid.selectionMode == 'none'){
          return;
        }
        var rowSelectCellAdded = false, inValidFields = ['get', 'formatter', 'field', 'fields'],
        defaultCellDef = {type: dojox.grid.cells.DijitMultipleRowSelector, name: '', editable: true, width:'30px', styles:'text-align: center;'};
        dojo.forEach(this.structure, dojo.hitch(this, function(view){
          var cells = view.cells;
          if(cells && cells.length > 0 && !rowSelectCellAdded){
            var firstRow = cells[0];
            if(firstRow[0] && firstRow[0]['isRowSelector']){
              console.debug('addRowSelectCell() - row selector cells already added, return.');
              rowSelectCellAdded = true;
              return;
            }
            var selectDef, cellType = this.grid.selectionMode == 'single' ? dojox.grid.cells.DijitSingleRowSelector : dojox.grid.cells.DijitMultipleRowSelector;
            if(!dojo.isObject(this.grid.indirectSelection)){
              selectDef = dojo.mixin(defaultCellDef, {type: cellType});
            }else{
              selectDef = dojo.mixin(defaultCellDef, this.grid.indirectSelection, {type: cellType, editable: true});
              dojo.forEach(inValidFields, function(field){//remove invalid feilds
                if(field in selectDef){ delete selectDef[field]; }
              });
            }
            cells.length > 1 && (selectDef["rowSpan"] = cells.length);//for complicate layout
            dojo.forEach(this.cells, function(cell, i){
              if(cell.index >= 0){
                cell.index += 1;
                //console.debug('cell '+ (cell.index - 1) +  ' is updated to index ' + cell.index);
              }else{
                console.debug('Error:IndirectSelection.addRowSelectCell()-  cell ' + i + ' has no index!');
              }
            });

            var rowSelectCell = this.addCellDef(0, 0, selectDef);

            //begin override
            if(this.grid.plugins.indirectSelection.position == "right"){
              rowSelectCell.index = this.cells.length + 1;
              firstRow.push(rowSelectCell);
              this.cells.push(rowSelectCell);
              this.grid.rowSelectCell = rowSelectCell;
              rowSelectCellAdded = true;
            }else{
              rowSelectCell.index = 0;
              firstRow.unshift(rowSelectCell);
              this.cells.unshift(rowSelectCell);
              this.grid.rowSelectCell = rowSelectCell;
              rowSelectCellAdded = true;
            }
            //end override
          }      
        }));    
        this.cellCount = this.cells.length;
      }
    }
  );

Change History (4)

comment:1 Changed 9 years ago by Douglas Hays

Owner: changed from bryanforbes to Bryan Forbes

comment:2 Changed 9 years ago by Bryan Forbes

Owner: changed from Bryan Forbes to evan

comment:3 Changed 8 years ago by Evan

Owner: changed from evan to Evan

comment:4 Changed 7 years ago by Evan

Milestone: tbd1.9
Resolution: wontfix
Status: newclosed

New grid enhancements are assumed to be addressed by the new dgrid or gridx. So closing.

Note: See TracTickets for help on using tickets.