EasyUI 的 formatter事件的函数的使用

摘要:
id="+id;title="设置";shadow=true;varcontent='';varboarddiv='';//style="overflow:hidden;"可以去掉滚动条$.append;varwin=$.dialog;win.dialog;}iframe的传值问题的解决functiongeturl{varreg=newRegExp("[^?=null){returndecodeURI;}return"";}根据documentation的描述,formatter的格式化函数有3个parameters,分别是:value:thefieldvalue,也就是field:'id'。就是这一行的Json数据,包括你已经选择在Datagrid上显示的内容,和没显示的内容。因为我的Json数据里包括了Id这一内容,所以我可以直接调用。如果你作为数据源的Json里没有Id属性,需要修改一下Json的输出。
<body style="visibility: visible;">
    <table id="menuview"idField="menuId"rownumbers="true"pagination="true"fitColumns="true"singleSelect="false"pageSize="15"pageList="[15,30,45,60]"toolbar="#tb"url="${pageContext.request.contextPath }/menu/list.action"
        >
        <thead>  
            <tr>  
                <th field="menuId"width="50"align="center"checkbox="true"></th>
                <th field="name"width="80"align="center" >按钮名称</th>  
                <th field="actionURL"width="80"align="center" >按钮URL</th>  
                <th field="parentMenu"width="80"align="center" >上级按钮</th>  
                <th field="modify"     formatter="rowFormater" align="center">操作</th>
            </tr>  
        </thead>
    </table>
    <div id="tb">  
        <a href="${pageContext.request.contextPath }/menu/addMenu.jsp"class="easyui-linkbutton"iconCls="icon-add"plain="true">新增</a>  
        <a href="#"class="easyui-linkbutton"iconCls="icon-remove"plain="true"onclick="javascript:delData();">删除</a> 
    </div> 
</body>
functionrowFormater(value, row, index) {
       return  '<a href="javascript:void(0)" onclick="showMessageDialog('+ row.menuId+');">设置</a>';
    }
    //url:窗口调用地址,title:窗口标题,width:宽度,height:高度,shadow:是否显示背景阴影罩层  
    functionshowMessageDialog(id) {  
        url="${ctx}/menu/menuManage.jsp?id="+id;
        title="设置";
        shadow=true;
        var content = '<iframe    src="https://tool.4xseo.com/article/13288.html' + url + '"     frameborder="0" scrolling="no"></iframe>';  
        var boarddiv = '<div   title="' + title + '"></div>'; //style="overflow:hidden;"可以去掉滚动条  
$(document.body).append(boarddiv);  
        var win = $('#msgwindow').dialog({  
            content: content,  
             "700px",  
            height: "500px",  
            modal: shadow,  
            title: title,  
            onClose: function() {  
                $(this).dialog('destroy');//后面可以关闭后的事件  
}  
        });  
        win.dialog('open');  
       }  

iframe的传值问题的解决

functiongeturl(name) {
            var reg = new RegExp("[^?&]?" + encodeURI(name) + "=[^&]+");
            var arr = window.parent.document.getElementById("menuAdminManage").contentWindow.location.search.match(reg);
            if (arr != null) {
                return decodeURI(arr[0].substring(arr[0].search("=") + 1));
            }
            return "";
        }
根据documentation的描述,formatter的格式化函数有3个parameters,分别是:
value: the field value,也就是field:'id'。rowData: the row record data。
就是这一行的Json数据,包括你已经选择在Datagrid上显示的内容,和没显示的内容。
因为我的Json数据里包括了Id这一内容,所以我可以直接调用。如果你作为数据源的Json里没有Id属性,需要修改一下Json的输出。
我的每行Json输出是类似{"id":"1","name":"u7ecfu6d4eu53d1u5c55","parentId":"0"}的结构

rowIndex: the row index.当前行的Index。

免责声明:文章转载自《EasyUI 的 formatter事件的函数的使用》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Gitee Git bash VSCode操作简易说明appium+selenium自动化测试UI踩坑记录之--判断元素是否存在下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

SpringBoot全局配置文件

SpringBoot项目使用一个全局的配置文件application.properties或者是application.yml,在resources目录下或者类路径下的/config下,一般我们放到resources下。 1、修改tomcat的端口为8088 server.port=8088 重新启动应用,查看效果: 2018-09-18 20:55:06...

mongodb 配置均衡器的运行窗口

考虑到数据迁移会降低系统性能,可以配置均衡器在只在特定时间段运行,比如夜里系统负载比较小的时候。详细的配置步骤如下; 连接到任意的mongos服务器,并通过安全认证(如果有认证的话)。 切换到config数据库: use config 启动均衡器: sh.setBalancerState( true ) 配置时间窗口: db.settings.upd...

Extjs4——表单与输入控件

1.表单的简单形式: var form = new Ext.form.FormPanel({ title: 'form', defaultType: 'textfield', buttonAlign: 'center', frame: true, 220,...

cocos creator3.0.0 vscode配置

settings.json { "debug.javascript.unmapMissingSources": true, "search.exclude": { "**/node_modules": true, "**/bower_components": true, "bui...

分享在winform下实现左右布局多窗口界面

在web页面上我们可以通过frameset,iframe嵌套框架很容易实现各种导航+内容的布局界面,而在winform、WPF中实现其实也很容易,我这里就分享一个:在winform下实现左右布局多窗口界面。 我这里说的多窗口是指一个父窗口包含多个子窗口,在winform中实现这种效果很简单,即将某个窗口的IsMdiContainer设为true,然后将其它...

es7.4.0集群部署

其实主要是配置的变化,需要指定下master节点 cluster.name: prod-es node.name: node1 node.master: true node.data: true path.data: /srv/data/elk/elasticsearch path.logs: /srv/logs/elk/elasticsearch n...