EXTJS中grid的数据特殊显示,不同窗口的数据传递
//EXTJS中grid的数据特殊显示
renderer : function(value, metaData, record, rowIndex, colIndex, store, view) { var USED_AMOUNT_ = 0; for (var i = 0; i < matMonthPlanHisList.length; i++) { if(matMonthPlanHisList[i].MAT_NO_ == record.get('MAT_NO_')){ USED_AMOUNT_ = matMonthPlanHisList[i].USED_AMOUNT_; break; } } return record.get('AMOUNT_') - USED_AMOUNT_; }
不同窗口的数据传递
var success = window.showModalDialog('preImportMatYearPlan.do?YEAR_=' + Ext.getCmp('YEAR_').getValue() + '&MAT_TYPE_=' + Ext.getCmp('MAT_TYPE_').getValue() + '&random=' + Math.random(), window, 'resizable=yes; dialogWidth=960px; dialogHeight=500px');
var MAT_YEAR_PLN_BATCH_ID_ = ''; var YEAR_ = ''; var MAT_TYPE_ = '';if (location.href.split('?')[1] != undefined) { var parameters = Ext.urlDecode(location.href.split('?')[1]); (parameters.YEAR_ == undefined) ? YEAR_ = '' : YEAR_ = parameters.YEAR_; (parameters.MAT_TYPE_ == undefined) ? MAT_TYPE_ = '' : MAT_TYPE_ = parameters.MAT_TYPE_; }
常用监听,函数:
Ext.panel.Table view source cellclick( Ext.view.Table this, HTMLElement td, Number cellIndex, Ext.data.Model record, HTMLElement tr, Number rowIndex, Ext.EventObject e, Object eOpts ) 单击表格单元格时触发。
celldblclick( Ext.view.Table this, HTMLElement td, Number cellIndex, Ext.data.Model record, HTMLElement tr, Number rowIndex, Ext.EventObject e, Object eOpts ) 双击表格单元格时触发。
callback : function(options, success, response) { }
listeners : { load : function(store, records) { } }
listeners : { 'select' : function(combo, records, eOpts) { } }
格式化Double数据处理
renderer : function(value, metaData, record, rowIndex, colIndex, store, view) { return Ext.util.Format.number(value, '0.00'); }
//不允许为空,需要和类似与Panel的控件的items下的allowBlank : false,一起使用做判断 function _validate(obj) { var valid = true; for (var i = 0; i < obj.items.length; i++) { if (obj.items.getAt(i).xtype != 'button' && obj.items.getAt(i).xtype != 'panel' && !obj.items.getAt(i).validate()) { valid = false; } } return valid; }