paip.提升效率--数据绑定到table原理和流程Angular js  jquery实现

html

#--keyword 1

#---原理和流程 1

#----jq实现的代码 1

#-----Angular 的实现 3

#--keyword

jquery 遍历表格tr  td

Angular 模板绑定

#---原理和流程

获得所有的行,第一的头行..排除,,,在的所有的删除.

遍历表格tr获得tds的所有的id数组.

根据id/id索引来获得绑定的数据源里面的数据字段..绑定到个td上..

或者容易的使用mvc框架 Angular JS,Angular 也能绑定,实现dsl  4 html

作者 老哇的爪子 Attilax 艾龙,  EMAIL:1466519819@qq.com

转载请注明来源: http://blog.csdn.net/attilax

#----jq实现的代码

<table id="table1">

<tr id="tem">

<td id="awd">

awd

</td>

<td id="timex">

timex

</td>

<td id="BusinessName">

BusinessName

</td>

<td id="btn">

<input id="Button2" type="button" value="button" />

</td>

</tr>

</table>

<p> </p>

<p><script src="jquery-1.11.0.min.js"></script> </p>

<script>

bindJson2table("li.json","table1")

function bindJson2table(jsonUrl, tableID) {

$.getJSON(jsonUrl, null,

function(obj) {

$("#" + tableID + " tr").eq(0).nextAll().remove(); //将除模板行的tr删除

//o430

//todox jquery trav tr td

//jq get element list

var tds = $("#tem td");

var prpts = new Array();

for (var i = 0; i < tds.length; i++) {

prpts.push(tds[i].id);

}

//将获取到的数据动态的加载到table中

for (var i = 0; i < obj.length; i++) {

//获取模板行,复制一行

var row = $("#tem").clone();

//将新一行的按钮添加click事件

//    row.find("#btn input").click({ name: obj[i].CHRCARNUMBER, back: obj[i].CKRID }, operation);

//注意:在jquery1.4.2中,上面的方法会出错,具体原因我也不知道,反正1.7.1这样写是没有问题的

//如果上面代码不行,你可以试一下

//row.find("#btn input").bind("click",{ name: obj[i].CHRCARNUMBER, back: obj[i].CKRID }, operation);

//亲测上面的代码在1.4.2.min...中可以运行,这个问题的解决浪费了很长事件,都怪用了比较老的框架

for (var j = 0; j < prpts.length; j++) {

var prpt = prpts[j];

row.find("#" + prpt).text(obj[i][prpt]);

}

//    row.find("#awd").text(obj[i].awd); //流水号

//    row.find("#timex").text(obj[i].timex);   //汽车车牌号

//    row.find("#BusinessName").text(obj[i].BCRNAME);     //所办理的业务名称

//将新行添加到表格中

row.appendTo("#" + tableID);

}

});

}

</script>

#-----Angular 的实现

<html  ng-app>  //must jeig ,beirs ma fein.

<script src="angular.min.js"></script>

<script>

function AlbumCtrl($scope) {

$scope.images = [

{"url":" image_01.png", "description":"url 01 description"},

{"url":" image_02.png", "description":"url 02 description"},

{"url":" image_03.png", "description":"url 03 description"},

{"url":" image_04.png", "description":"url 04 description"},

{"url":" image_05.png", "description":"Image 05 description"}

];

}

</script>

<div ng-controller="AlbumCtrl">

<table width="600" border="1" cellspacing="0" cellpadding="0" ng-controller="AlbumCtrl">

<tr>

<td>img</td>

<td>name</td>

<td>op</td>

</tr>

<tr ng-repeat="image in images">

<td>{{image.url}}---------</td>

<td>{{image.description}}</td>

<td>aaa</td>

</tr>

</table>

paip.提升效率--数据绑定到table原理和流程Angular js jquery实现的更多相关文章

  1. paip.提高工作效率--数据绑定到table原则和过程Angular js jquery实现

    paip.提高工作效率--数据绑定到table原理和流程Angular js  jquery实现 html #--keyword 1 #---原理和流程 1 #----jq实现的代码 1 #----- ...

  2. paip.提升效率--批量变量赋值 “多元”赋值

    paip.提升效率--批量变量赋值 "多元"赋值 ##石麻是批量变量赋值. 为一组变量赋值. 例子 1 <?php $my_array = array("Dog&q ...

  3. paip.提升效率---filter map reduce 的java 函数式编程实现

    #paip.提升效率---filter map reduce 的java 函数式编程实现 ======================================================= ...

  4. paip.提升效率--调试--日志系统日志参数含义---python

    paip.提升效率--调试--日志系统日志参数含义---python #同时向控制台和文件输出日志 #日志参数含义 import logging log_format = '%(filename)s ...

  5. paip.提升效率---request自动绑定domain object

    paip.提升效率---request自动绑定domain object #.keyword,subtitle关键字,子标题 ------------------------- 复制request属性 ...

  6. paip.提升效率--僵尸代码的迷思

    paip.提升效率--僵尸代码的迷思 僵尸代码是指你的代码库里被注释掉的那部分代码, 很少去使用它,就像僵尸一样, 看雷kill-the-zombies-in-your-code ========== ...

  7. paip.提升效率---提升绑定层次--form绑定取代field绑定

    paip.提升效率---提升绑定层次--form绑定取代field绑定 =================== 编辑form中,常常需要,绑定一个对象到个form..   传统上要绑定field开始. ...

  8. paip.提升效率--gui 的选择--swing最佳实践swt awt

    paip.提升效率--gui 的选择--swing最佳实践swt awt ////////////////弹出消息框. ////////////////myeclipse swing 开发最佳实践.. ...

  9. PAIP.提升效率----论项目知识库的建设。。

    PAIP.提升效率----论项目知识库的建设.. 作者Attilax ,  EMAIL:1466519819@qq.com  来源:attilax的专栏 地址:http://blog.csdn.net ...

随机推荐

  1. [原创]HEXO博客搭建日记

    博客系统折腾了好久,使用过Wordpress,Ghost,Typecho,其中Typecho是我使用起来最舒心的一种,Markdown编辑+轻量化设计,功能不多不少刚好,着实让我这种强迫症患者舒服了好 ...

  2. C# 生成条形码

    原文地址:http://www.cnblogs.com/xcsn/p/4514759.html 引用BarcodeLib.dll(百度云中有)生成条形 protected void Button2_C ...

  3. Xcode 设置代码不自动换行

    "command + ,"打开设置界面后,找到"Text Editing" 然后选择"Indentation", 最后找到"lin ...

  4. 使用Dapper时,如何将MySqlParameters[] 变成Dapper.DynamicParameters动态对象

    在开发过程中,如何替原生的参数化MySqlParameters[]换成Dpapper的参数化DynamicParameters对象正确的做法:var args = new DynamicParamet ...

  5. JS的循环、复杂运算符

    一.循环语句 特点:可以重复完成同样的事情 1.while(条件语句/boolean){  重复执行的代码块 } while的两种写法         var a= prompt("请输入第 ...

  6. Python学习第四天集合

    集合定义: 无序排列,可哈希 支持集合关系测试 成员关系测试 in not in 迭代 不支持:索引.元素获取.切片 集合的类型:set(),frozenset() 集合没有特定语法格式,只能通过工厂 ...

  7. aix 6+ mount 光驱

    AIX 挂载光驱的方法 系统环境: [root@Big A:/1]#oslevel -s6100-06-00-0000 [root@Big A:/]#crfs -v cdrfs -p ro -d '/ ...

  8. 数位DP (51nod)

    题目:数字1的数量 思路:首先考察不同位数以内的所有整数出现1的次数,例如四位数以内[0,9999],个十百千位均有可能出现1, 出现1的时候,其它三个位均可以是0~9,所以假设固定一个位为1,另外三 ...

  9. jsp_属性范围_application

    如果希望设置一个属性,可以让所有用户看得见,则可以将属性范围设置成application,这样属性即可以保存在服务器上. 下面写一个小例子来验证一下: (1)application_demo.jsp ...

  10. 【转】JavaScript中,{}+{}等于多少?

    原文链接:http://www.2ality.com/2012/01/object-plus-object.html 译文链接:http://www.cnblogs.com/ziyunfei/arch ...