zoukankan      html  css  js  c++  java
  • 表格维护:快速

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>    

      <title>CellEdit 单元格编辑 </title>    

      <meta http-equiv="content-type" content="text/html; charset=UTF-8" />    

        <link href="../demo.css" rel="stylesheet" type="text/css" />        

      <script src="../../scripts/boot.js" type="text/javascript"></script>        

    <!--引入皮肤样式-->    

      <link href="../../scripts/miniui/themes/blue/skin.css" rel="stylesheet" type="text/css" />    

    </head>

      <body>    

        <h1>CellEdit 单元格编辑</h1>

           <div style="800px;">        

         <div class="mini-toolbar" style="border-bottom:0;padding:0px;">            

          <table style="100%;">                

          <tr>                    

            <td style="100%;">                        

               <a class="mini-button" iconCls="icon-add" onclick="addRow()" plain="true">增加</a>                        

               <a class="mini-button" iconCls="icon-remove" onclick="removeRow()" plain="true">删除</a>                        

            <span class="separator"></span>                        

              <a class="mini-button" iconCls="icon-save" onclick="saveData()" plain="true">保存</a>                               

             </td>                    

             <td style="white-space:nowrap;">                        

              <input id="key" class="mini-textbox" emptyText="请输入姓名" style="150px;" onenter="onKeyEnter"/> 

              <a class="mini-button" onclick="search()">查询</a>                    

            </td>                

          </tr>            

        </table>                  

        </div>    

        </div>    

        <div id="datagrid1" class="mini-datagrid" style="800px;height:280px;"  url="../data/AjaxService.aspx?method=SearchEmployees" idField="id"         allowResize="true" pageSize="20"   allowCellEdit="true" allowCellSelect="true"  multiSelect="true"  editNextOnEnterKey="true" >        

        <div property="columns">            

        <div type="indexcolumn"></div>            

        <div type="checkcolumn"></div>            

        <div field="loginname" width="120" headerAlign="center" allowSort="true">员工帐号                

          <input property="editor" class="mini-textbox" style="100%;" />            

        </div>            

        <div field="age" width="100" allowSort="true" >年龄                

          <input property="editor" class="mini-spinner"  minValue="0" maxValue="200" value="25" style="100%;"/>            

        </div>                       

        <div name="birthday" field="birthday" width="100" allowSort="true" dateFormat="yyyy-MM-dd">出生日期                

          <input property="editor" class="mini-datepicker" style="100%;"/>            

        </div>               

        <div field="remarks" width="120" headerAlign="center" allowSort="true">备注                

          <input property="editor" class="mini-textarea" style="100%;" minHeight="50"/>            

          </div>            

    <!--ComboBox:本地数据-->                    

        <div type="comboboxcolumn" autoShowPopup="true" name="gender" field="gender" width="100" allowSort="true"  align="center" headerAlign="center">性别                

          <input property="editor" class="mini-combobox" style="100%;" data="Genders" />                           

        </div>                                         

    <!--ComboBox:远程数据-->            

        <div type="comboboxcolumn" field="country" width="100" headerAlign="center" >国家                

          <input property="editor" class="mini-combobox" style="100%;" url="../data/countrys.txt" />                           

        </div>              

        <div type="checkboxcolumn" field="married" trueValue="1" falseValue="0" width="60" headerAlign="center">婚否</div>                   

      </div>    

      </div>    

    <script type="text/javascript">

                 var Genders = [{ id: 1, text: '男' }, { id: 2, text: '女'}];                

          mini.parse();

              var grid = mini.get("datagrid1");        

          grid.load();

            //////////////////////////////////////////////////////

            function search() {                  

        var key = mini.get("key").getValue();            

        grid.load({ key: key });        

    }

            function onKeyEnter(e) {            

        search();        

    }

            function addRow() {                     

         var newRow = { name: "New Row" };            

        grid.addRow(newRow, 0);        

    }        

       function removeRow() {            

        var rows = grid.getSelecteds();            

        if (rows.length > 0) {                

          grid.removeRows(rows, true);            

        }        

    }        

         function saveData() {            

          var data = grid.getChanges();            

          var json = mini.encode(data);                        

          grid.loading("保存中,请稍后......");            

          $.ajax({                

             url: "../data/AjaxService.aspx?method=SaveEmployees",                

            data: { data: json },                

            type: "post",                

            success: function (text) {                    

              grid.reload();                

            },                

            error: function (jqXHR, textStatus, errorThrown) {                    

              alert(jqXHR.responseText);                

            }           

           });        

        }

        </script>

        <div class="description">        

        <h3>Description</h3>        

        <ul>            

          <li>方向键导航单元格</li>            

          <li>按回车键进入编辑</li>            

          <li>按ESC键取消编辑</li>            

          <li>按Tab键进入下一个单元格编辑</li>            

            <li>editNextOnEnterKey="true"后,按回车键进入下一个单元格编辑</li>        

        </ul>    

      </div>

    </body>

    </html>

  • 相关阅读:
    神文章2:文本矩阵简述 V1.0 -vivo神人
    收集:经典语录收集
    java 实现唯一ID生成器
    Mybatis-Generator自动生成XML文件以及接口和实体类
    form表单提交,Servlet接收并读取Excel文件
    海南小地图(echart)
    Echart 仪表盘和柱形图
    微信小程序图片上传并展示
    springMvc基于注解登录拦截器
    这是一个定时脚本,主要功能是遍历该文件夹下的所有文件并存储到数组,对数据中的文件进行操作,一个一个移动到指定的目录下,并删除原有文件
  • 原文地址:https://www.cnblogs.com/szqblog/p/3269417.html
Copyright © 2011-2022 走看看