Liny_@NotePad

沉迷ACG中

使用DWR添加行中列表

YOYO posted @ 2009年5月12日 05:37 in 【Web开发】客户端 with tags DWR , 9379 阅读

 rt……想不出什么方法,我在列表显示的col那里return列表ID,之后的列里才调用增加option及设置默认选项的方法。

  1. function loadPhotoList(){
  2.         photoManager.getPhotoList(displayPhotoList);
  3. }
  4.  
  5. function displayPhotoList(photoList){
  6.         DWRUtil.removeAllRows("PhotoListTable");
  7.         var photo = photoList;
  8.         DWRUtil.addRows("PhotoListTable",photo,[
  9.                 function(photo){return "<select name='albumid" + photo.imgID + "'></select>";},
  10.                 function(photo){
  11.                                                 displayAlbumList(photo.imgID, photo.albumID); // here
  12.                                                 return "<center>" +
  13.                                                                 "<input type='button' value='修改' onclick='editPhoto(" + photo.imgID + ")'>" +
  14.                                                                 "&nbsp;&nbsp;" +
  15.                                                                 "<input type='button' value='删除' onclick='deletePhoto(" + photo.imgID + ")'>" +
  16.                                                                 "</center>";
  17.                                                 }
  18.         ]);
  19. }
  20.  
  21. function displayAlbumList(imgid, albumid){
  22.         albumManager.getAlbumList(function(albumList){ 
  23.                 DWRUtil.removeAllOptions("albumid" + imgid);
  24.                 DWRUtil.addOptions("albumid" + imgid,albumList, "id", "title");
  25.                 DWRUtil.setValue("albumid" + imgid, albumid);
  26.         });
  27. }

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter