dwr常用方法
dwr.util.removeAllOptions(id)//移除id值的option值
dwr.util.addOptions(id,array)//将array值添加到id值的option中 array可为数组,list,map,set
若option添加的array为map集合,则value值为key值
dwr.util.addRows( id, array, cellfuncs, [options] )//cellfuncs为循环接收array每个值的回调函数
例:function changeTables(){
service.getUsers(showUsers);//service为在dwr.xml中为js创建的类
}
//此为getUsers()的回调函数
function showUsers(users){
dwr.util.addRows("tableshow",
users,
[
function(u){alert(u.id);return u.id;},
function(user){return user.name;},
function(users){return users.major;}
]);
}
dwr.util.selectRange(id,start,end)//start开始索引,end终止索引
例:var text = $(MyText).value;
var comma = text.indexOf(",");
dwr.util.selectRange("MyText",0 ,comma);
dwr.util.getValue(id)//获取该id对应的value
dwr.util.setValue(id,value)//给该id设置value