標籤:style blog http io ar for 資料 sp cti
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:[email protected]
轉載請註明來源: 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;
}
});
}
atitit.表格的綁定client side 最佳實務