EditorGridPanel中ComboBox显示问题?

2019-03-25 13:37|来源: 网路

function getConsumerUnit(value){
	var rd = houFct.EmptyStore.getAt(0);
	if(rd){
	    return rd ? rd.get('unitName') : '请选择..'; 
	};
	if(houFct.get('consumerGrid').getGrid().store.getAt(0)){
		var rowIndex = houFct.get('consumerGrid').getGrid().store.find("consumerUnitID",value);
	    if(rowIndex<0) return;  
	    var record = houFct.get('consumerGrid').getGrid().store.getAt(rowIndex);
	    Ext.getCmp('risen-consumerUnitID').setValue(record.get('unitName'));
	    return record ? record.get('unitName') : '';  
	}
};

{
			dataIndex : 'consumerUnitID',
			header : '人员单位', width : 160,
			renderer : getConsumerUnit,
			editor : new Ext.form.ComboBox({
				id : 'risen-consumerUnitID',
				hiddenName : 'consumerUnitID',
				valueField : 'consumerUnitID', 
				displayField : 'unitName',
				editable : false,
				mode:'remote',
				store : houFct.EmptyStore,
				onTriggerClick : function(){
					Risen.CmpMgr.popWindow(houFct.get('HouConsumerUnitTabPanel'));
				},
				listeners : {
					focus : function(cbx){
						//这里的得到焦点分两种情况:一种是点击Grid的时候获得焦点,另一种是选择了树节点或获取焦点的情况
						//有两种情况就要建立一种通讯机制,什么时候改赋值;什么时候不该赋值.这里用一个标志位(flag)来判断着两种情况.
						if(houFct.get('flag')){
							houFct.setCombo(Ext.getCmp('risen-consumerUnitID').id, houFct.get('record'));
							houFct.put('flag', false);
						}
					}
				}
			})
		}


问题是处在EditorGridPanel中放ComboBox.renderer参数我只能控制我展示给用户看的.的却renderer能做到这点.我这里的问题是我点击cell后ComboBox显示的是valueField(感觉dataIndex是什么,ComboBox就显示什么,比如我这里dataIndex显示的是ID, ComboBox就是显示的ID;dataIndex显示name,ComboBox就显示name.我这里dataIndex显示的是id,但是我renderer过后让其显示的name,但ComboBox显示的还是ID,貌似,我renderer的时候也将ComboBox的值设置...试试看)
问题补充:
function getConsumerUnit(value){
	var rd = houFct.EmptyStore.getAt(0);
	if(rd){
	    return rd ? rd.get('unitName') : '请选择..'; 
	};
	if(houFct.get('consumerGrid').getGrid().store.getAt(0)){
		var rowIndex = houFct.get('consumerGrid').getGrid().store.find("consumerUnitID",value);
	    if(rowIndex<0) return;  
	    var record = houFct.get('consumerGrid').getGrid().store.getAt(rowIndex);
	    Ext.getCmp('risen-consumerUnitID').setValue(record.get('unitName'));
	    return record ? record.get('unitName') : '';  
	}
};

{
			dataIndex : 'consumerUnitID',
			header : '人员单位', width : 160,
			renderer : getConsumerUnit,
			editor : new Ext.form.ComboBox({
				id : 'risen-consumerUnitID',
				hiddenName : 'consumerUnitID',
				valueField : 'consumerUnitID', 
				displayField : 'unitName',
				editable : false,
				mode:'remote',
				store : houFct.EmptyStore,
				onTriggerClick : function(){
					Risen.CmpMgr.popWindow(houFct.get('HouConsumerUnitTabPanel'));
				},
				listeners : {
					focus : function(cbx){
						//这里的得到焦点分两种情况:一种是点击Grid的时候获得焦点,另一种是选择了树节点或获取焦点的情况
						//有两种情况就要建立一种通讯机制,什么时候改赋值;什么时候不该赋值.这里用一个标志位(flag)来判断着两种情况.
						if(houFct.get('flag')){
							houFct.setCombo(Ext.getCmp('risen-consumerUnitID').id, houFct.get('record'));
							houFct.put('flag', false);
						}
					}
				}
			})
		}


问题是处在EditorGridPanel中放ComboBox.renderer参数我只能控制我展示给用户看的.的却renderer能做到这点.我这里的问题是我点击cell后ComboBox显示的是valueField(感觉dataIndex是什么,ComboBox就显示什么,比如我这里dataIndex显示的是ID, ComboBox就是显示的ID;dataIndex显示name,ComboBox就显示name.我这里dataIndex显示的是id,但是我renderer过后让其显示的name,但ComboBox显示的还是ID,貌似,我renderer的时候也将ComboBox的值设置...试试看)
问题补充:
function getConsumerUnit(value){
	var rd = houFct.EmptyStore.getAt(0);
	if(rd){
	    return rd ? rd.get('unitName') : '请选择..'; 
	};
	if(houFct.get('consumerGrid').getGrid().store.getAt(0)){
		var rowIndex = houFct.get('consumerGrid').getGrid().store.find("consumerUnitID",value);
	    if(rowIndex<0) return;  
	    var record = houFct.get('consumerGrid').getGrid().store.getAt(rowIndex);
	    Ext.getCmp('risen-consumerUnitID').setValue(record.get('unitName'));
	    return record ? record.get('unitName') : '';  
	}
};

{
			dataIndex : 'consumerUnitID',
			header : '人员单位', width : 160,
			renderer : getConsumerUnit,
			editor : new Ext.form.ComboBox({
				id : 'risen-consumerUnitID',
				hiddenName : 'consumerUnitID',
				valueField : 'consumerUnitID', 
				displayField : 'unitName',
				editable : false,
				mode:'remote',
				store : houFct.EmptyStore,
				onTriggerClick : function(){
					Risen.CmpMgr.popWindow(houFct.get('HouConsumerUnitTabPanel'));
				},
				listeners : {
					focus : function(cbx){
						//这里的得到焦点分两种情况:一种是点击Grid的时候获得焦点,另一种是选择了树节点或获取焦点的情况
						//有两种情况就要建立一种通讯机制,什么时候改赋值;什么时候不该赋值.这里用一个标志位(flag)来判断着两种情况.
						if(houFct.get('flag')){
							houFct.setCombo(Ext.getCmp('risen-consumerUnitID').id, houFct.get('record'));
							houFct.put('flag', false);
						}
					}
				}
			})
		}


问题是处在EditorGridPanel中放ComboBox.renderer参数我只能控制我展示给用户看的.的却renderer能做到这点.我这里的问题是我点击cell后ComboBox显示的是valueField(感觉dataIndex是什么,ComboBox就显示什么,比如我这里dataIndex显示的是ID, ComboBox就是显示的ID;dataIndex显示name,ComboBox就显示name.我这里dataIndex显示的是id,但是我renderer过后让其显示的name,但ComboBox显示的还是ID,貌似,我renderer的时候也将ComboBox的值设置...试试看)
问题补充:
function getConsumerUnit(value){
	var rd = houFct.EmptyStore.getAt(0);
	if(rd){
	    return rd ? rd.get('unitName') : '请选择..'; 
	};
	if(houFct.get('consumerGrid').getGrid().store.getAt(0)){
		var rowIndex = houFct.get('consumerGrid').getGrid().store.find("consumerUnitID",value);
	    if(rowIndex<0) return;  
	    var record = houFct.get('consumerGrid').getGrid().store.getAt(rowIndex);
	    Ext.getCmp('risen-consumerUnitID').setValue(record.get('unitName'));
	    return record ? record.get('unitName') : '';  
	}
};

{
			dataIndex : 'consumerUnitID',
			header : '人员单位', width : 160,
			renderer : getConsumerUnit,
			editor : new Ext.form.ComboBox({
				id : 'risen-consumerUnitID',
				hiddenName : 'consumerUnitID',
				valueField : 'consumerUnitID', 
				displayField : 'unitName',
				editable : false,
				mode:'remote',
				store : houFct.EmptyStore,
				onTriggerClick : function(){
					Risen.CmpMgr.popWindow(houFct.get('HouConsumerUnitTabPanel'));
				},
				listeners : {
					focus : function(cbx){
						//这里的得到焦点分两种情况:一种是点击Grid的时候获得焦点,另一种是选择了树节点或获取焦点的情况
						//有两种情况就要建立一种通讯机制,什么时候改赋值;什么时候不该赋值.这里用一个标志位(flag)来判断着两种情况.
						if(houFct.get('flag')){
							houFct.setCombo(Ext.getCmp('risen-consumerUnitID').id, houFct.get('record'));
							houFct.put('flag', false);
						}
					}
				}
			})
		}


问题是处在EditorGridPanel中放ComboBox.renderer参数我只能控制我展示给用户看的.的却renderer能做到这点.我这里的问题是我点击cell后ComboBox显示的是valueField(感觉dataIndex是什么,ComboBox就显示什么,比如我这里dataIndex显示的是ID, ComboBox就是显示的ID;dataIndex显示name,ComboBox就显示name.我这里dataIndex显示的是id,但是我renderer过后让其显示的name,但ComboBox显示的还是ID,貌似,我renderer的时候也将ComboBox的值设置...试试看)

相关问答

更多
  • 使用 listWidth:Number 配置选项 您可以计算最大内容元素的长度,然后在组合的“展开”事件中设置listWidth 干杯! Use the listWidth : Number config option You could calculate the length of the largest content element and then set the listWidth in the 'expand' event of the combo Cheers!
  • 如果您正在处理MVC应用程序并且想要创建网格的扩展,然后想要将该网格的实例与xtype一起使用。 您必须将别名设置为widget.xtypename。 Ext.define('AM.view.user.List' ,{ extend: 'Ext.grid.Panel', alias : 'widget.userlist' }); If you are working on a MVC application and want to create an extension of a grid and then ...
  • 使用下面的东西。 这将为每一行添加一个类。 然后,您可以根据其类添加一些CSS来设置行的样式。 getRowClass: function(record) { return record.get('parameter_1') === 'value1' ? 'class-1' : 'class-2'; } }, Use something like below. This will add a class to each row. You can then add some CSS ...
  • 此解决方案并不理想(例如,您可以为从组合框继承的控件创建自定义控件模板),但它可以正常工作。 XAML ...
  • 如果通过“锁定”意味着使列不可编辑,则可能是指Column.editable配置选项: { header: 'ID', width: 30, editable: false, sortable: true, dataIndex: 'id', hidden: true } 您还可以通过ColumnModel.setEditable(Number col,Boolean editable)以编程方式更新此值,如下所示: grid.getColumnModel() ...
  • 来自您的评论: 我怀疑你没有调用Form3()默认构造函数,但你正在调用一些其他Form3(string somethig)构造函数,它接受一个或多个参数。 请检查您调用此Form3然后调用默认构造函数或其他构造函数。 如果你正在调用一些接受参数的其他构造函数,请添加Fillcombo(); 声明还有。 From Your comments: I Suspect that you are not calling the Form3() default constructor but you are call ...
  • 好的,我看到你现在的样子。 在网格渲染时立即在每行上显示组合框。 这可能很难实现,我怀疑它可能会对网格的整体性能产生负面影响(多个组合框渲染而不是一个)。 在任何情况下,你看过clicksToEdit配置选项吗? 来自ExtJS文档: 显示单元格编辑器所需的单元格点击次数(默认为2)。 将此选项设置为“自动”意味着所选单元格上的mousedown开始编辑该单元格。 如果您尝试将其设置为“自动”怎么样? 在编辑开始之前,这至少会减少用户必须执行的鼠标点击量。 这就是你真正追求的吗? (请注意,我自己没有尝试过 ...
  • 因为您的属性SelectedVehicle是引用类型。 将SelectedValue绑定到ViewModel.SelectedVehicle 组合框将有界Collection的对象与SelectedVehicle对象进行比较 通过调用.Equals方法进行比较,该方法默认比较引用,如果两个对象都引用相同的内存地址,则返回true 因为选择的项目没有出现,所以我假设SelectedVehicle参考不在收集Vehicles 。 您可以在类Vehicle覆盖Equals方法以通过某些属性进行比较。 在你的情况下 ...
  • 你应该自己渲染显示值。 在网格列规范中查找渲染器选项。 配置渲染器 它将提供选定的价值和相关的商店记录 您可以根据您的逻辑返回显示值(从字面上接受任何值) you should render the display value yourself. look for renderer option in grid column spec. configure renderer it will supply selected value, and related store record you can ret ...
  • SelectedItem的实例 必须存在于 ItemsSource 。 从你的代码 //Code filled ComboBox CodeWidgets = (new Code().Get("UPFLTY").Result).ToList(); SelectedCodeWidget = new Code(2707); // THIS is where you bugged! 您可以看到SelectedCodeWidget设置为Code一个新实例,一个不在CodeWidgets中的CodeWidgets 。 ...