123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- Ext.define('saas.override.grid.column.CheckColumn', {
- override: 'Ext.grid.column.Check',
- /**
- * 是否switch模式
- */
- switch: false,
- switchOffCls: Ext.baseCSSPrefix + 'grid-switchcolumn',
- switchOnCls: Ext.baseCSSPrefix + 'grid-switchcolumn-checked',
- constructor: function (config) {
- config = config || {};
- if (config.switch) {
- config.checkboxCls = this.switchOffCls;
- config.checkboxCheckedCls = this.switchOnCls;
- }
- this.scope = this;
- this.callParent([
- config
- ]);
- },
- defaultRenderer: function (value, cellValues, a, b, c, d, e, f) {
- var me = this,
- cls = me.checkboxCls,
- tip = '';
- if (me.invert) {
- value = !value;
- }
- if (me.disabled) {
- cellValues.tdCls += ' ' + me.disabledCls;
- }
- if (value) {
- cls += ' ' + me.checkboxCheckedCls;
- tip = me.checkedTooltip;
- } else {
- tip = me.tooltip;
- }
- if (tip) {
- cellValues.tdAttr += ' data-qtip="' + Ext.htmlEncode(tip) + '"';
- }
- if (me.useAriaElements) {
- cellValues.tdAttr += ' aria-describedby="' + me.id + '-cell-description' + (!value ? '-not' : '') + '-selected"';
- }
- // This will update the header state on the next animation frame
- // after all rows have been rendered.
- me.updateHeaderState();
- if (typeof value == 'object' && value == null) {
- cellValues.style = 'display: none;';
- cellValues.tdCls += ' ' + me.disabledCls;
- cellValues.innerCls = me.disabledCls;
- cellValues.classes.push(me.disabledCls);
- cellValues.cellRole = me.disabledCls;
- return '<span style="display: none;" class="' + me.disabledCls + '"></span>'
- }
- //hideCheckField hideCheckVal
- //根据 某个字段 判断该行的checkbox 是否要隐藏 ,后期可拓展
- if (e.selModel && e.selModel.hideCheckField) {
- var field = e.selModel.hideCheckField;
- var checkVal = e.selModel.hideCheckVal;
- if (a.get(field) == checkVal) {
- cellValues.style = 'display: none;';
- cellValues.tdCls += ' ' + me.disabledCls;
- cellValues.innerCls = me.disabledCls;
- cellValues.classes.push(me.disabledCls);
- cellValues.cellRole = me.disabledCls;
- return '<span style="display: none;" class="' + me.disabledCls + '"></span>'
- }
- }
- return '<span class="' + cls + '" role="' + me.checkboxAriaRole + '"' + (!me.ariaStaticRoles[me.checkboxAriaRole] ? ' tabIndex="0"' : '') + '></span>';
- },
- updater: function (cell, value) {
- var me = this,
- tip;
- if (me.invert) {
- value = !value;
- }
- if (value) {
- tip = me.checkedTooltip;
- } else {
- tip = me.tooltip;
- }
- if (tip) {
- cell.setAttribute('data-qtip', tip);
- } else {
- cell.removeAttribute('data-qtip');
- }
- if (me.useAriaElements) {
- me.updateCellAriaDescription(null, value, cell);
- }
- cell = Ext.fly(cell);
- cell[me.disabled ? 'addCls' : 'removeCls'](me.disabledCls);
- Ext.fly(cell.down(me.getView().innerSelector, true).firstChild)[value ? 'addCls' : 'removeCls'](me.checkboxCheckedCls);
- // This will update the header state on the next animation frame
- // after all rows have been updated.
- me.updateHeaderState();
- }
- });
|