Experience of using jquery easyui--Based on Spring and MyBatis

Keywords: Attribute Windows JQuery Spring

1. About Added and Edited

this.add = function() {
		var selection = tree.tree('getSelected');
		var treeId = selection.id;
		var treeName = selection.text;
		addDialog = $.topDialog({
		    title:'Newly added',
		    iconCls:'icon-save',
		    href:addWinPath,
		    width : 800,     
			height : 400,
			resizable : true,
			modal : true,
			onClose:function(){
				addDialog = undefined;
				tempRec = undefined;
				editDialog = undefined;
			},
			onLoad:function(){	
				//Assignment of Hidden Area ID
				addDialog.find('[name="areaid"]').val(treeId);
				addDialog.find('[name="areaname"]').val(treeName);
		    },
			buttons:[{
				text:'Preservation',
				handler:function(){
					if(undefined == tempRec && null == tempRec){
						addDialog.find('.dialog-button .l-btn:first-child').linkbutton('disable');
						saveForminfo('new',addDialog);
					}else{
						editSave();
					}
				}
			},{
				text:'Close',
				handler:function(){
					if(editDialog){
						$.topDialog('close',editDialog);
					}
					if(addDialog){
						$.topDialog('close',addDialog);
					}
				}
			}]
		});
	}
topDialog Important Attribute Description and Notes:

onClose: window closure (upper right corner *) event, in which data removal operations can be added to prevent data confusion caused by caching and other reasons when multiple popups of windows occur; Note: The default method of jQuery EasyUI is to hide the window rather than remove it!

onLoad: Rendering events when windows are loaded, in which window data initialization can be performed; data backfilling when editing is editDialog.find('form').form('load', record) in this event;

2.Ajax use

$.ajax({
			url: contextPath + '/mvc/xxx/xyyyy/zzzz/service/tree',
			data:{'id':node.id},
			success:function(nodes){
				if(nodes.length > 0){
					$('.add_button').linkbutton('disable');
				}else{
					$('.add_button').linkbutton('enable');
				}
				grid.datagrid('load', {areaid:node.id});
			}
		});
@RequestMapping("/xxx/xyyyy/zzzz")

/**
	 * Tree Node Query
	 * 
	 * @param param
	 *            Front desk related parameters
	 * @return Current page record
	 */
	@RequestMapping("/service/tree")
	@ResponseBody
	public List<TreeModel<T>> tree(String id, String root) {
		if (StringUtils.isNotBlank(root) && StringUtils.isBlank(id)) {
			// Contains the current node
			return new TreeView(service.listTreeRoot(root)).convertTree();
		} else {
			// Child node
			String isAble = "";//Institutional state
			return new TreeView(service.listTreeById(id, isAble, null)).convertTree();
		}
	}


Attribute description:

url: Background request path. This example is based on Spring and MyBatis framework. Path attention corresponds to Background Request Mapping.

data: Set of parameters;

success: callback function



Posted by gigantorTRON on Fri, 08 Feb 2019 10:06:17 -0800