当前位置 : 主页 > 网页制作 > Dojo >

Dojo DataGrid 控件的 onCellDblClick 事件的工作流程

来源:互联网 收集:自由互联 发布时间:2021-06-15
jsp 代码: !-- 数据列表 --div id="dataGrid" data-dojo-type="dojox.grid.EnhancedGrid"data-dojo-props='structure : manuPlanEntry.layout ,autoHeight : false,escapeHTMLInData : false,canSort : commonFunc.canSort,onStartEdit:function(inCe

jsp 代码:

			<!-- 数据列表 -->
			<div id="dataGrid" data-dojo-type="dojox.grid.EnhancedGrid"
					data-dojo-props='structure : manuPlanEntry.layout ,
					autoHeight : false,
					escapeHTMLInData : false,
					canSort : commonFunc.canSort,
					onStartEdit:function(inCell, inRowIndex){
						dijit.byId("applyEditButton").set("disabled",false);
					},
					onApplyEdit:function(){
						dijit.byId("applyEditButton").set("disabled",true);
					},
					onCancelEdit:function(){
						dijit.byId("applyEditButton").set("disabled",true);
					},
					style : "width: 100%; height: auto;",
					plugins : {
						indirectSelection : {
							headerSelector : true,
							name : "Selection",
							width : "60px",
							styles : "text-align: center;"
						}
					}'>
				</div>


	dojo.addOnLoad(function() {
		dojo.connect(dijit.byId("dataGrid"),"onCellDblClick",manuPlanEntry.onCellDblClick);

	});


js 代码:

		,onCellDblClick:function(evt){
			if(evt.target.cellIndex==3||evt.target.cellIndex==4){
				dojo.byId("itemSelect_handlerFunction").value = "manuPlanEntry.itemUpdateSelect_handler";
				dojo.byId("dataGridRowIndex").value=evt.rowIndex;
				itemSelect.show();
//				dijit.byId("addDlg").show();
			}
			if(evt.target.cellIndex==7){
				dojo.byId("deviceSelect_handlerFunction").value = "manuPlanEntry.deviceUpdateSelect_handler";
				dojo.byId("dataGridRowIndex").value=evt.rowIndex;
				deviceSelect.show();
			}
		
		}


		,itemUpdateSelect_handler: function(items ){
			var index=dojo.byId("dataGridRowIndex").value;
			var item=dijit.byId("dataGrid").getItem(index);
			dijit.byId("dataGrid").get("store").setValue(item, "itemId", items[0].id);
			dijit.byId("dataGrid").get("store").setValue(item, "itemName", items[0].name);
			dijit.byId("dataGrid").get("store").setValue(item, "itemHelpCode", items[0].helpCode);
			dijit.byId("dataGrid").get("store").setValue(item, "unitId", items[0].measureUnitId);
			dijit.byId("dataGrid").get("store").setValue(item, "unitName", items[0].measureUnit);
			
		}
网友评论