easyui datagrid 每條數據后添加操作按鈕


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

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM