angularJs增加行的操作
<!-- 编辑窗口 -->
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog" >
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">规格编辑</h3>
</div>
<div class="modal-body"> <table class="table table-bordered table-striped" width="800px">
<tr>
<td>规格名称</td>
<td><input class="form-control" placeholder="规格名称" ng-model="entity.specification.specName"> </td>
</tr>
</table> <!-- 规格选项 -->
<div class="btn-group">
<button type="button" class="btn btn-default" title="新建" ng-click="addTableRow()"><i class="fa fa-file-o"></i> 新增规格选项</button> </div> <table class="table table-bordered table-striped table-hover dataTable">
<thead>
<tr> <th class="sorting">规格选项</th>
<th class="sorting">排序</th>
<th class="sorting">操作</th>
</thead>
<tbody>
<tr ng-repeat="pojo in entity.specificationOptionList"> <td>
<input class="form-control" placeholder="规格选项" ng-model="pojo.optionName">
</td>
<td>
<input class="form-control" placeholder="排序" ng-model="pojo.orders">
</td>
<td>
<button type="button" class="btn btn-default" title="删除" ng-click="deleTableRow($index)" ><i class="fa fa-trash-o"></i> 删除</button>
</td>
</tr> </tbody>
</table> </div>
//$scope.entity={specificationOptionList:[]}; //增加规格选项行
$scope.addTableRow=function(){
$scope.entity.specificationOptionList.push({});
} //删除规格选项行
$scope.deleTableRow=function(index){
$scope.entity.specificationOptionList.splice(index,);
}
具体思路:是由于在里面是一个循环体绑定了数据,向数据中添加一个空数据,所以就可以进行了,就可以添加一行了
<div class="pull-left">
<div class="form-group form-inline">
<div class="btn-group">
<button type="button" class="btn btn-default" title="新建" data-toggle="modal" data-target="#editModal" ng-click="entity={specificationOptionList:[]}"><i class="fa fa-file-o"></i> 新建</button>
<button type="button" class="btn btn-default" title="删除" ng-click="dele()"><i class="fa fa-trash-o"></i> 删除</button> <button type="button" class="btn btn-default" title="刷新" onclick="window.location.reload();"><i class="fa fa-refresh"></i> 刷新</button>
</div>
</div>
</div>
使用$index就可以获取当前行的索引,来删除相应的行
angularJs增加行的操作的更多相关文章
- DataTable数据类型的一些操作 增加行、插入行、修改数据、修改列名、修改列顺序、计算、选取或删除行(列)、排序、某列distinct值 等
Datatable 这个数据类型在C#中涉及到对数据库读取时的用处还是挺大的,最近在处理一个报表开发时,一开始把所有的操作都放在sql 上面来做,就是我需要什么样的数据我就query出什么,但是这样其 ...
- poi读取Excel模板并修改模板内容与动态的增加行
有时候我们可能遇到相当复杂的excel,比如表头的合并等操作,一种简单的方式就是直接代码合并(浪费时间),另一种就是写好模板,动态的向模板中增加行和修改指定单元格数据. 1.一个简单的根据模板shee ...
- js 动态增加行删除行
<body> <table id="tableID" border="1" align="center" width=&q ...
- mongoVUE的增删改查操作使用说明
mongoVUE的增删改查操作使用说明 一. 查询 1. 精确查询 1)右键点击集合名,再左键点击Find 或者直接点击工具栏上的Find 2)查询界面,包括四个区域 {Find}区,查询条件格式{& ...
- (转)SQLite数据库增删改查操作
原文:http://www.cnblogs.com/linjiqin/archive/2011/05/26/2059182.html SQLite数据库增删改查操作 一.使用嵌入式关系型SQLite数 ...
- jquery plugins —— datatables 增加行号
table = $("#Table").DataTable({ "rowCallback": function (row, data, dataIndex) { ...
- 详谈easyui datagrid增删改查操作
转自:http://blog.csdn.net/abauch_d/article/details/7734395 前几天我把easyui dadtagrid的增删改查的实现代码贴了出来,发现访问量达到 ...
- Python教程:连接数据库,对数据进行增删改查操作
各位志同道合的同仁可以点击上方关注↑↑↑↑↑↑ 本教程致力于程序员快速掌握Python语言编程. 本文章内容是基于上次课程Python教程:操作数据库,MySql的安装详解 和python基础知识之上 ...
- PHP程序中使用PDO对象实现对数据库的增删改查操作的示例代码
PHP程序中使用PDO对象实现对数据库的增删改查操作(PHP+smarty) dbconn.php <?php //------------------------使用PDO方式连接数据库文件- ...
随机推荐
- Tkinter控件(python GUI)
- 使用HttpClient进行Post通信
---------------siwuxie095 首先到 Apache官网 下载相关的库文件 Apache官网:http://www.apac ...
- SWT简介
--------------siwuxie095 SWT 简介: SWT(Standard Widget Toolkit) 也是基于一个对等体实 ...
- return()函数
在函数中,执行完return()函数后,下面的语句就不会再执行了.例子: <?php function fn() { echo "you are awsome"; retur ...
- 为什么一些公司把dwg文件转化为pdf
是因为dwg文件中可能会涉及到字体问题 这台电脑打开dwg没问题,另一台电脑可能没有相应的字体用autocad打开就会出现乱码,所以先转化为pdf,而pdf有固定格式的作用,能够保证一台电脑打开是什么 ...
- linux安装thrift
安装配置Thrift Thrift的编译器使用C++编写的,在安装编译器之前,首先应该保证操作系统基本环境支持C++的编译,安装相关依赖的软件包,如下所示 sudo yum install autom ...
- bzoj4619 4619: [Wf2016]Swap Space
传送门 分析 首先不难想到我们要先处理容量变大的再处理容量变小的 对于第一种情况我们自然要选择x小的先格式化,因为这个样暂时存储所需空间较小,可以使得情况更优 而第二种情况y先考虑,因为这样对总空间的 ...
- SDUT 3373 数据结构实验之查找一:二叉排序树
数据结构实验之查找一:二叉排序树 Time Limit: 400MS Memory Limit: 65536KB Submit Statistic Problem Description 对应给定的一 ...
- C++: I/O流详解
一.输入流操作 1.read 无格式输入指定字节数 istream& read ( char* pch, int nCount ); istream& read ( unsigned ...
- EIP权限工作流升级说明-2019/3/12
流程配置界面,允许流程处理按钮名称自定义:适用于流程过程中显示不同字面意思.流程节点按钮配置界面 流程处理过程中