Blame view

js/lib/ext-override.js 4.71 KB
16035364   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
/** 
 * Project  : AMDA-NG4
 * Name     : ext-override.js
 * @file     ext-override.js
  
 * @brief   patches for extjs
 * @author  elena (sencha support)
 * @version $Id: ext-override.js 2345 2014-05-13 09:06:43Z elena $
 *******************************************************************************
 *    FT Id     :   Date   : Name - Description
 *******************************************************************************
 *  :           :16/06/2011 : elena  -  creation
 * 
 */

Ext.onReady(function () {  
    
// for version 4.1.3 - corrected in 4.2.2    
  /*Ext.override(Ext.grid.RowNumberer, {
     renderer: function(value, metaData, record, rowIdx, colIdx, store) {
        var rowspan = this.rowspan;
        if (rowspan){
            metaData.tdAttr = 'rowspan="' + rowspan + '"';
        }

        metaData.tdCls = Ext.baseCSSPrefix + 'grid-cell-special';        
       
        return store.indexOf(record) + 1;
    }
  });*/
  
//TODO check if needed for  version 4.1.3,  4.2.2   
    /*Ext.override(Ext.view.Table, {
      onUpdate : function(store, record, operation, changedFieldNames) {
        var me = this,
            index,
            newRow, oldRow,
            oldCells, newCells, len, i,
            columns, overItemCls,
            isHovered, row;
            
        if (me.rendered) {        
            index = me.store.indexOf(record);
            columns = me.headerCt.getGridColumns();
            overItemCls = me.overItemCls;

            // If we have columns which may *need* updating (think lockable grid child with all columns either locked or unlocked)
            // and the changed record is within our view, then update the view
	    
            if (columns.length && index > -1) {
                newRow = me.bufferRender([record], index)[0];
                oldRow = me.all.item(index);
		if (oldRow){
                isHovered = oldRow.hasCls(overItemCls);
                oldRow.dom.className = newRow.className;
                if(isHovered) {
                    oldRow.addCls(overItemCls);
                }

                // Replace changed cells in the existing row structure with the new version from the rendered row.
                oldCells = oldRow.query(this.cellSelector);
                newCells = Ext.fly(newRow).query(this.cellSelector);
                len = newCells.length;
                // row is the element that contains the cells.  This will be a different element from oldRow when using a rowwrap feature
                row = oldCells[0].parentNode;
                for (i = 0; i < len; i++) {
                    // If the field at this column index was changed, replace the cell.
                    if (me.shouldUpdateCell(columns[i], changedFieldNames)) {
                        row.insertBefore(newCells[i], oldCells[i]);
                        row.removeChild(oldCells[i]);
                    }
                }
		}
                // Maintain selection after update
                // TODO: Move to approriate event handler.
                me.selModel.refresh();
                me.doStripeRows(index, index);
                me.fireEvent('itemupdate', record, index, newRow);
            }
        }
       }
      });*/
    
//TODO check if needed for  version 4.1.3,  4.2.2     
   /*Ext.override(Ext.ZIndexManager, {
      tempHidden: [],
      show: function() {
	var comp, x, y;
	
	while (comp = this.tempHidden.shift()) {
	  x = comp.x;
	  y = comp.y;
	  
	  comp.show();
	  comp.setPosition(x,y);
      }
    }      
7ac3e07e   Elena.Budnik   do not check user...
98
    }); 
98a79839   Elena.Budnik   anomalie 4830
99

7ac3e07e   Elena.Budnik   do not check user...
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
    Ext.override(Ext.selection.TreeModel, {
	    
	onRowClick: function (view, record, item, index, e) {
		// Record index will be -1 if the clicked record is a metadata record and not selectable		 
  		if (index !== -1) {
			if (!this.allowRightMouseSelection(e)) {			      
				return ;			 
			}
	
			//Don't process if it's a right-click over a previously selected record.
			// if (!(e.type === 'contextmenu' && this.isSelected(record))) {
				this.processSelection(view, record, item, index, e);
			// }
		} 
	}
    });
	Ext.override(Ext.selection.Model, {
16035364   Benjamin Renard   First commit
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
		storeHasSelected: function(record) {
			var store = this.store,
				records,
				len, id, i;

			if (record.hasId() && store.getById(record.getId())) {
				return true;
			} else {
				if (store.buffered) {//on buffered stores the map holds the data items
	                records = [];
	                for (m in store.data.map) {
	                    records = records.concat(store.data.map[m].value);
	                }
	            } else {
	                records = store.data.items;
	            }
				len = records.length;
				id = record.internalId;

				for (i = 0; i < len; ++i) {
					if (id === records[i].internalId) {
						return true;
					}
				}
			}
			return false;
		}
5d15649f   Benjamin Renard   Migration to ExtJ...
144
	});*/
16035364   Benjamin Renard   First commit
145
146
});