atitit.表格的绑定client side 最佳实践

atitit.表格的绑定client side 最佳实践 

1. 框架选型 1

2. #---原理和流程 1

1. 方法1 1

2. Dwr 例子 1

3. 方法2 2

4. Jq例如 2

1. 框架选型

Easyui ..走十难调整???

嘎自的表格只好js jvc ,,,angular

Dwr也能了...

2. #---原理和流程

1. 方法1

获得所有的行,第一的头行except,第二模板line,..排除,,,在的所有的数据行删除.

遍历表格模板tr获得tds的所有的id(yash  obj.propty)数组.

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

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

2. Dwr 例子

Foreach dataList:::z[

  dwr.util.cloneNode;/// note id propty yao del...coloneRow

   Foreach headList>>  经过column index,get propty name,   thend tds[idx]=obj.propty

End for

Add coloneRow2table..

//or }

3. 方法2

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

4. Jq例如

function fillTable() {

  People.getSmallCrowd(function(people) {

    // Delete all the rows except for the "pattern" row

    dwr.util.removeAllRows("peoplebody", { filter:function(tr) {

      return (tr.id != "pattern");

    }});

    // Create a new set cloned from the pattern row

    var person, id;

    people.sort(function(p1, p2) { return p1.name.localeCompare(p2.name); });

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

      person = people[i];

      id = person.id;

      dwr.util.cloneNode("pattern", { idSuffix:id });

      dwr.util.setValue("tableName" + id, person.name);

      dwr.util.setValue("tableAge" + id, person.age);

      dwr.util.setValue("tableAddress" + id, person.address);

      dwr.util.setValue("tableSuperhero" + id, person.superhero ? "Yes" : "No");

      dwr.util.byId("pattern" + id).style.display = ""; // officially we should use table-row, but IE prefers "" for some reason

      peopleCache[id] = person;

    }

  });

}

我要啦免费统计
原文地址:https://www.cnblogs.com/attilax/p/5963876.html