This article mainly introduces relevant information to you about the summary of jQuery EasyUI development skills. I hope that through this article, you can master the development skills of EasyUI. Friends who need it can refer to it. I hope it can help everyone.
jQuery EasyUI development skills summary
1. When using tabs, if you use content instead of url, you must embed iframe
addTab({ title:node.text, closeable:true, content:‘<iframe src="'+url+'" frameborder="0" style="border:0;width:100%;height:99%"></iframe> });
1) External call to the tag content inside the iframe
<button onclick="console.info($('iframe').contents().find('#frameId'));"/>
2) Internal call External method:
onclick="parent.getData();"
2. Query submission form:
function serarchFun(){//搜索 $("#datagrid").datagrid("load", serializeObject($("#searchForm"))); } function cleanFun(){//清空 $("#searchForm input").val(''); $("#datagrid").datagrid("load", {}); } function removeFun(){//删除 var rows=$("#datagrid").datagrid("getChecked"); var ids[] = new Array(); if(rows.length>0){ for(var i=0;i<rows.length;i++){ ids.push(row[i].id); } $.ajax({ url:'${rootPath}/user_delete.action', data:{ids:ids.join(',')}, dataType:'json', success:function(data){ $('#datagrid').datagrid('load'); $('#datagrid').datagrid('unselectAll'); $.messager.Show({ title:'提示', msg:data.msg }); } }) }else{ $.messager.Show({ title:'提示', msg:'不能删除' }); } }
3. Add checkbox:
##
$("#datagrid").datagrid( url:"${rootPath}/user_add.action", idField:'id', checkOnSelect:false, selectOnCheck:true,//选中复选框选中 frozonColumns:[[{ field:'id', title:'编号', width:150, checkbox:true },{ field:'name', title:'登陆名称', width:150, sortable:true }]], columns:[[{ field:'pwd', title:'密码', width:150, formatter: function(){ return:"****************" } }]] );
4. Confirmation dialog box:
$.messager.confirm('确认','你真的要删除吗?',function(data){ if(data){ } });
5. Edit to implement dynamic loading of the page
##
function editFun(){ var rows=$("#datagrid").datagrid("getChecked"); $('<p/>').dialog({ width:500, height:200, href:'${rootPath}/edit.jsp, modal:true, title:'编辑用户', buttons:[{ text:编辑, handler:function(){ $('#editForm').form('submit',{ url:'${rootPath}/user_edit.action', success:function(data){ var obj = JQuery.parseJSON(data); if(obj.success){ $('#edit_dialog').dialog('close'); } $.messager.show({ title:'提示', msg:obj.msg }); } } } }], onClose:function(){//必须写的 $(this).dialog('destroy'); }, onOpen:function(){ var data = rows[0]; }, onLoad:function(){//初始化数据,填充数据 var data = rows[0]; $("#editForm").form("load", data); } }); }
var rows=(‘#datagrid').datagrid(‘getChecked');(‘#datagrid').datagrid(‘updateRow',{ index:$(‘#datagrid').datagrid(‘getRowIndex',rows[0]), row:result.obj });
The above is the detailed content of Summary of EasyUI development skills for jQuery. For more information, please follow other related articles on the PHP Chinese website!