zoukankan      html  css  js  c++  java
  • table中填写数据并批量增加

    <table class = "table jtable table-bordered table-striped hide" id = "table_1" >    
                                                <thead>
                                                <tr>
                                                    <th style = " 50px;" >序号</th>
                                                    <th style = " 150px;" >预算编号</th>
                                                    <th style = " 100px;" >参考编号</th>
                                                    <th style = " 220px;" >预算名称</th>
                                                    <th style = " 100px;"  class='teaDept' >部门</th>      
                                                    <th style = " 100px;"  class='teaBrand'>品牌</th>        
                                                    <th style = " 100px;"  class='teaBudItem'>预算科目</th>
                                                    <th style = " 50px;"  class='teaCompany'>公司</th>  
                                                    <th style = " 100px;" >预算币种</th>
                                                    <th style=" 50px;">操作</th>
                                                </tr>
                                                </thead>
                                                <tbody>
                                                <tr class = "tr_row" >
                                                    <td>
                                                        <span class="label label-sm label-success label-mini"> 1 </span>
                                                    </td>                                                                                                 
                                                    <td>
                                                        <input class = "form-control input-sm txt-required valid  eaBudcode" id = "BudgetCode" name = "BudgetCode" type = "text" value = "" placeholder = "支持系统生成/用户输入,系统内唯一即可" data-bind="value:BudgetCode"/>
                                                    </td>
                                                    <td>                                                                                   
                                                        <input class = "form-control input-sm  eaClientCode" id = "tbClientCode" name = "tbClientCode" type = "text" value = ""/>
                                                    </td>
                                                    <td>                                                                             
                                                        <textarea rows = "2" class = "form-control input-sm txt-required valid eaBudName" id = "tbBudName" name = "tbBudName" ></textarea>
                                                    </td>
                                                    <td class='teaDept'>
                                                        <select class = "fk-select form-control  eaDept" id = "ddlDept" name="ddlDept" ></select> 
                                                    </td>
                                                    <td class='teaBrand'>
                                                        <select class = "fk-select form-control eaBrand" id = "ddlBrand" name="ddlBrand" >   
                                                        </select>
                                                    </td>
                                                    <td class='teaBudItem'>
                                                        <select class = "fk-select form-control eaBudItem" id = "ddlBudItem" name="ddlBudItem">   
                                                        </select>
                                                    </td>
                                                    <td class='teaCompany'>
                                                        <select class = "fk-select form-control eaCompany" id = "ddlCompany"  name="ddlCompany">     
                                                        </select>
                                                    </td>
                                                    <td>
                                                        <select class = "fk-select form-control  eaCurrency" id = "ddlCurrency" name="ddlCurrency" > 
                                                        </select>
                                                    </td>
                                                    <td>
                                                        <div class="input-group btn-group-xs  margin-bottom-5">
                                                            <span class="input-group-btn margin-top-5" data-title="faplus">
                                                                <a href="javascript:void(0);" class="btn default btn-xs" name="CopyTr" title="复制"><i class="fa fa-plus"></i></a>
                                                            </span>
                                                            <span class="input-group-btn " data-title="faplus">
                                                                <a href="javascript:void(0);" class="btn default btn-xs" name="DelTr" title="删除"><i class="fa fa-minus"></i></a>
                                                            </span>
                                                        </div>
                                                    </td>
                                                </tr>
                                            </table>

    以下是table的js

     /* 获取table表格的数据项.*/
            function getTableData() {
                var data = [];
                $("#table_1 tbody tr").each(function(i, item) {
                    data.push({
                        "BudgetCode" : $("input[name='BudgetCode']", item).val(),
                        "ClientCode" : $("input[name='tbClientCode']", item).val(),
                        "BudgetName" : $("textarea[name='tbBudName']", item).val(),
                        "DeptID" : $("select[name='ddlDept']", item).val(),
                        "BrandID" : $("select[name='ddlBrand']", item).val(),
                        "BudgetItemID" : $("select[name='ddlBudItem']", item).val(),
                        "CompanyID" : $("select[name='ddlCompany']", item).val(),
                        "CurrencyID" : $("select[name='ddlCurrency']", item).val(),
                        "BudCategoryID": $("#ddlBudCategory").val(),      //预算类别id  
                        "ParentID": $("#tbParBudCode").val()                   //上级编号
                });
                });
                //console.log("data1:" + data);
                return data; //返回数据
            }


  • 相关阅读:
    oracle 11g wm_concat 、 listagg 函数的使用(合并数据)
    Quartz.net 开源job调度框架(二)----定点执行
    Quartz.net 开源job调度框架(一)
    Quartz.NET
    基于ASP.NET的comet简单实现
    W3wp.exe占用CPU及内存资源
    SysTick Software Timer
    ARM Memory Copy
    ARM LDR/STR, LDM/STM 指令
    STM32 USART 波特率计算
  • 原文地址:https://www.cnblogs.com/MartinLee/p/7622613.html
Copyright © 2011-2022 走看看