addRows 4 parameters separately for the table (table, tbody, thead, tfoot, recommend using the back of the three, can accurately positioning) of the id, the data collection (array, list or map), and his data show the methods and options, the specific use of the following :
dwr.util.addRows("searchResult",list,cellFuncs,{
rowCreator:function(options){
var row = document.createElement("tr");
row.onmouseover= function () {
//鼠标放上去的效果
};
row.onmouseout= function () {
//鼠标移开的效果
};
//其他事件
return row;
},
cellCreator:function(options){
var td = document.createElement("td");
//定制td属性
return td;
},
escapeHtml:false}//防止html直接显示
);
cellFuncs inside the function has several rows of data will appear
var cellFuncs = [
function(datas) { return datas.docType; },
function(datas) { return datas.docDt; },
function(datas) {
var inputEl = document.createElement("span");
inputEl.innerHTML = datas.docCount;
inputEl.id = datas.id+"_s";
return inputEl;
},
function(datas) {
var inputEl = document.createElement("input");
inputEl.type = "text";
inputEl.id = datas.id+"_i";
inputEl.size = 6;
inputEl.maxLength = 8;
inputEl.className = "xx";
return inputEl;
},
function(datas) {
var addButton = document.createElement("input");
addButton.type="button";
addButton.className="yy";
addButton.value="操作";
addButton.onclick=function(){
checkInputNum(datas);
}
return addButton;
}
];
Finally a few parameters of the options are as follows:
rowData: the equivalent of cellFuncs the datas, said his data.
rowIndex: index data set, if the map was key, to start counting from 0.
rowNum: with almost rowIndex, but this indicates that the container be a number of existing data, rather than the index.
data: cellCreator inside the application that the contents inside the td.
cellNum: cellCreator inside the application, that the td where the number of rows.
If you have any questions can give my guestbook.








Responses to “dwr addRows Ways”