http://docs.sencha.com/extjs/4.1.3/#!/api/Ext.grid.View
在下面提供我的代码
/**
* @ignore
* @method createAutoTip - Helper method to create a tooltip which shows
* itself only when the element's contents cannot fully be seen.
*
* @param tooltipElementId the id of the element
*/
sports.ux.grid.createAutoTip = function (tooltipElementId) {
return Ext.create('Ext.tip.ToolTip',{
target: tooltipElementId.el,
delegate: ':any(.x-grid-cell-inner|.x-grid-hd-inner)',
bodyCls: 'sports-grid-tooltip',
renderTo: Ext.getBody(),
listeners: {
beforeshow: function updateTipBody(tip) {
var trigger = tip.triggerElement;
//
// Idea for scrollWidth>offsetWidth check got from this link:
// http://stackoverflow.com/questions/4927257/text-overflowellipsis-in-firefox-4
//
var s = Ext.query("[skiptip=true]", trigger);
if (!Ext.isEmpty(s) || trigger.scrollWidth <= trigger.offsetWidth) {
//tip.body.dom.innerHTML = '';
return false; // don't show tip
}
tip.body.dom.innerHTML = trigger.innerHTML;
return true;
}
}
});
};
/**
* GridView extension supporting following features:
*
* * sports-value column headers.
* * Hide sorting options if column is not sortable, instead of just disabling them.
*
* This is used by {@link sports.ux.grid.GridPanel}.
*/
Ext.define('sports.ux.grid.GridView', {
extend : 'Ext.grid.View',
alias: 'widget.sports.ux.gridview',
mixins: {
gridviewcompositecolumn: 'sports.ux.grid.GridViewCompositeColumn'
},
requires: [
'sports.util.MessageBox'
],
/**
* @cfg
* Text shown for the "sports-value header" popup menu tied to columns of a grid.
*/
sports-valueHeaderText: 'sports-value header',
/**
* @cfg
* Text shown for the title of the popup prompt used to enter the new column header.
*/
sports-valuePromptTitleText: 'sports-value column heading',
/**
* @cfg
* Text shown for the label next to the input box on the popup prompt
* used to enter the new column name.
*/
sports-valuePromptMsgText: 'Enter new column heading name',
/**
* @cfg
* Message to display when the name of the column is not unique among
* the other columns.
*/
sports-valueFailedText: 'sports-value failed: a column with header "{0}" already exists!',
/**
* @cfg
* Flag to control if we hide the Sort Ascending/Sort Descending when the column isn't sortable.
* Defaults to `true`.
*/
hideIfNotSortable: true,
/**
* @cfg {Boolean} restrictsports-value
* Specify `true` to restrict renaming column headers for this grid. Defaults to `false`.
*/
restrictsports-value: false,
//@private
error_title: 'Error - Grid Component',
enableTextSelection: true,
constructor: function(config){
Ext.apply(this, config);
this.headerCt.addEvents({
/**
* @event columnsports-value
* @param {Ext.grid.header.Container} ct The grid's header Container which encsportsulates all column headers.
* @param {Ext.grid.column.Column} column The Column header Component which provides the column definition
* @param {String} new text
*/
columnsports-value: true
});
sports.ux.grid.GridView.superclass.constructor.apply(this, arguments);
// Settings from this point cannot be changed from outside
// Allow us to add the sports-value menu.
this.headerCt.on('menucreate', this.onMenuCreate, this);
},
/**
* @private create the menu before it is shown
* @param {Object} headerCt
* @param {Object} menu
*/
onMenuCreate: function(headerCt, menu) {
menu.on('show', this.onMenuShow, this);
},
//updating my method
onRowFocus:function(){
console.log("here- on row focus");
//check a new config to the grid panel and
this.callParent();
//set supressFocus, then call the super.onRowFocus
this.callSuper();
}
});