easyui table row edit event

easyui table row edit event

HTML page code

1. onDblClickRow double-click row event;
2. onAfterEdit: edit complete event, these two must be added;
3. editor: {type: 'numberbox'} input type when editing

<table id="tt" class="easyui-datagrid"  data-options="onDblClickRow: onDblClickRow,
onAfterEdit:onAfterEdit" >
	<tr>
		<th data-options="editor:{type:'numberbox'}"></th>
	</tr>
</table>

js code

var editIndex = undefined;
function endEditing(){
	if (editIndex == undefined){return true}
	if ($('#tt').datagrid('validateRow', editIndex)){
		$('#tt').datagrid('endEdit', editIndex);
		editIndex = undefined;
		return true;
	} else {
		return false;
	}
}
//双击行事件
function onClickRow(index){
	if (editIndex != index){
		if (endEditing()){
			$('#tt').datagrid('selectRow', index).datagrid('beginEdit', index);
			editIndex = index;
		} 
	}
}

//编辑完成事件
function onAfterEdit(index){
	alret(111);
	editIndex = undefined;
}
Published 8 original articles · Likes0 · Visits 314

Guess you like

Origin blog.csdn.net/weixin_43804546/article/details/86660946