Alien-Web-ExtJS-V3
view release on metacpan or search on metacpan
share/docs/source/GridView.html view on Meta::CPAN
resolveCell : function(row, col, hscroll) {
if (!Ext.isNumber(row)) {
row = row.rowIndex;
}
if (!this.ds) {
return null;
}
if (row < 0 || row >= this.ds.getCount()) {
return null;
}
col = (col !== undefined ? col : 0);
var rowEl = this.getRow(row),
colModel = this.cm,
colCount = colModel.getColumnCount(),
cellEl;
if (!(hscroll === false && col === 0)) {
while (col < colCount && colModel.isHidden(col)) {
col++;
}
cellEl = this.getCell(row, col);
}
return {row: rowEl, cell: cellEl};
},
<span id='Ext-grid-GridView-method-getResolvedXY'> /**
</span> * @private
* Returns the XY co-ordinates of a given row/cell resolution (see {@link #resolveCell})
* @return {Array} X and Y coords
*/
getResolvedXY : function(resolved) {
if (!resolved) {
return null;
}
var cell = resolved.cell,
row = resolved.row;
if (cell) {
return Ext.fly(cell).getXY();
} else {
return [this.el.getX(), Ext.fly(row).getY()];
}
},
<span id='Ext-grid-GridView-method-syncFocusEl'> /**
</span> * @private
* Moves the focus element to the x and y co-ordinates of the given row and column
*/
syncFocusEl : function(row, col, hscroll) {
var xy = row;
if (!Ext.isArray(xy)) {
row = Math.min(row, Math.max(0, this.getRows().length-1));
if (isNaN(row)) {
return;
}
xy = this.getResolvedXY(this.resolveCell(row, col, hscroll));
}
this.focusEl.setXY(xy || this.scroller.getXY());
},
<span id='Ext-grid-GridView-method-ensureVisible'> /**
</span> * @private
*/
ensureVisible : function(row, col, hscroll) {
var resolved = this.resolveCell(row, col, hscroll);
if (!resolved || !resolved.row) {
return null;
}
var rowEl = resolved.row,
cellEl = resolved.cell,
c = this.scroller.dom,
p = rowEl,
ctop = 0,
stop = this.el.dom;
while (p && p != stop) {
ctop += p.offsetTop;
p = p.offsetParent;
}
ctop -= this.mainHd.dom.offsetHeight;
stop = parseInt(c.scrollTop, 10);
var cbot = ctop + rowEl.offsetHeight,
ch = c.clientHeight,
sbot = stop + ch;
if (ctop < stop) {
c.scrollTop = ctop;
} else if(cbot > sbot) {
c.scrollTop = cbot-ch;
}
if (hscroll !== false) {
var cleft = parseInt(cellEl.offsetLeft, 10),
cright = cleft + cellEl.offsetWidth,
sleft = parseInt(c.scrollLeft, 10),
sright = sleft + c.clientWidth;
if (cleft < sleft) {
c.scrollLeft = cleft;
} else if(cright > sright) {
c.scrollLeft = cright-c.clientWidth;
}
}
return this.getResolvedXY(resolved);
},
( run in 0.689 second using v1.01-cache-2.11-cpan-787462296c9 )