码迷,mamicode.com
首页 > 其他好文 > 详细

easyui datagrid 每条数据后添加操作按钮

时间:2015-06-26 20:57:56      阅读:118      评论:0      收藏:0      [点我收藏+]

标签:

easyui datagrid 每条数据后添加“编辑、查看、删除”按钮

1、给datagrid添加操作字段:字段值

技术分享
<table class="easyui-datagrid" data-options="singleSelect:true,collapsible:true,url:‘publish.json‘,method:‘get‘,fit:true" 
                style="width: 700px; height: 250px">
                <thead>
                    <tr>
                        <th data-options="field:‘itemid‘,width:‘10%‘,align:‘center‘">序号</th>
                        <th data-options="field:‘productid‘,width:‘15%‘,align:‘center‘">标题</th>
                        <th data-options="field:‘listprice‘,width:‘15%‘,align:‘center‘">信息类型</th>
                        <th data-options="field:‘unitcost‘,width:‘15%‘,align:‘center‘">附件情况</th>
                        <th data-options="field:‘attr1‘,width:‘15%‘,align:‘center‘">发布时间</th>
                        <th data-options="field:‘status‘,width:‘15%‘,align:‘center‘">发布状态</th>
                        <th data-options="field:‘operate‘,width:‘15%‘,align:‘center‘,formatter:operate_formatter">操作</th>
                    </tr>
                </thead>
            </table>
View Code

2、javascript实现:

技术分享
     <script type="text/javascript">
         function operate_formatter(value, row, index) {
             return "<a href=‘#‘ class=‘easyui-linkbutton‘>编辑</a>/\
             <a href=# class=easyui-linkbutton>查看</a>/             <a href=# class=easyui-linkbutton>删除</a>";
         }
    </script>
View Code

 

easyui datagrid 每条数据后添加操作按钮

标签:

原文地址:http://www.cnblogs.com/shenchao/p/4603128.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!