欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

EXT gridpanel中实现下拉框

程序员文章站 2022-03-26 23:02:28
...
		    	afterrender:function(){
		    		var hostId = Ext.getCmp("vCpu_numa_host_id").getValue();
		    		var nodeName = Ext.getCmp("vCpu_numa_node_id").getValue();

					ajaxRequest({
						url: getContextPath() + '/load.action',
		    			params : {'id': hostId, 'nodeName': nodeName},
		    			async: '1',
		    			loadMastTarget: Ext.getBody(),
		    			complete : function(hCpuList)
		    			{
		    				if (hCpuList) 
		    				{
		    					Ext.getCmp('vCpu_numa_bind_id').getColumnModel().setRenderer(1,function(value, cellmeta, record) {
		    						if (hCpuList == undefined || hCpuList == '')
		    						{
		    							return	"<select id='numaCore_"+record.get("vmCPU") + "' disabled='disabled' >"
		    						    +"<option value='-1' selected = 'selected'>" + platform_common_select + "</option></select>"
		    						}
		    						else
		    						{
		    							var temp = '';
		    							for (var i = 0; i < hCpuList.length; i++)
		    							{
		    								var pt = hCpuList[i].id;
		    								var ptname = hCpuList[i].value;
		    								temp = temp + '<option value=\'' + pt + '\'>' + ptname + '</option>';
		    							}
		    							return "<select id='numaCore_"+record.get("vmCPU") + "' >" 
		    								+ "<option value='-1' selected = 'selected'>" + platform_common_select + "</option>"
		    								+ temp + "</select>"
		    							
		    						}
		    					});
		    					
		    				}
		    				
						}
		    		});
			}





   			    	select: function(group, value)
   			    	{
   			    		var hostId = Ext.getCmp("vCpu_numa_host_id").getValue();
   			    		var nodeName = Ext.getCmp("vCpu_numa_node_id").getValue();
   			    		
						ajaxRequest({
							url: getContextPath() + '/load.action',
			    			params : {'id': hostId, 'nodeName': nodeName},
			    			async: '1',
			    			loadMastTarget: Ext.getBody(),
			    			complete : function(hCpuList)
			    			{
			    				if (hCpuList) 
			    				{
			    					for(var i = 0; i < cpuNum; i++)
			    					{
				    					var str = '';
				    					if (hCpuList == undefined || hCpuList == '')
			    						{
			    							str = 	"<select id='numaCore_"+i + "' disabled='disabled' >"
			    						    +"<option value='-1' selected = 'selected'>" + platform_common_select + "</option></select>"
			    						}
			    						else
			    						{
			    							var temp = '';
			    							for (var j = 0; j < hCpuList.length; j++)
			    							{
			    								var pt = hCpuList[j].id;
			    								var ptname = hCpuList[j].value;
			    								temp = temp + '<option value=\'' + pt + '\'>' + ptname + '</option>';
			    							}
			    							str =  "<select id='numaCore_"+i + "' >" 
			    								+ "<option value='-1' selected = 'selected'>" + platform_common_select + "</option>"
			    								+ temp + "</select>"
			    						}

			    						var dom = document.getElementById("numaCore_" + i);
			    						dom.innerHTML = str;
			    					}
			    					
			    				}
			    				
							}
			    		});
						
   			    	}




https://www.cnblogs.com/xdp-gacl/p/3938361.html
https://my.oschina.net/vernon/blog/363693
相关标签: ext