类似ListView ,htc组件[2]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 lxx8402 的 blog

 element.onpropertychange = propertychange;

 var html = "";

 //判断工具栏是否显示
 if(toolbardisplay == '')
  toolbardisplay = eval(displaytoolbar) ? '' : 'none';
 
 //-------------------------- 建立工具栏 ----------------------------------
 html = "<table id=toolbar class=lvtoolbar cellpadding=0 cellspacing=0 style='display:" + toolbardisplay + "'><tr>";
 html += "<td id=searchcell>" + makebutton('search') + "&nbsp;</td>";
 html += "<td id=editrowcell><table cellpadding=0 cellspacing=0><tr>"
 html += "<td id=updaterowcell>" + makebutton('updatebtn') + "</td>";
 html += "<td id=insertrowcell>" + makebutton('insertbtn') + "</td>";
 html += "<td id=deleterowcell>" + makebutton('deletebtn') + "&nbsp;</td>";
 html += "</tr></table></td>"
 
 //建立navigation栏
 for(var i in navbuttons){
  html += "<td id=" + navbuttons[i] + "cell>" + makebutton( navbuttons[i] ) + "</td>"
  if (i==1)
   html += "<td id=pageinfocell>&nbsp;" + text['page'] + "&nbsp;<select class=lv id=pagenumber></select>&nbsp;" + text['of'] + "&nbsp;<input class=lv id=pagecount readonly type=text size=1></input>&nbsp;</td>";
 }

 html += "<td id=rowinfocell>&nbsp;" + text['rows'] + "&nbsp;<input class=lv id=rowcount readonly type=text size=2></input></td>";
 //navigation栏结束

 html += "<td id=savecell><table cellpadding=0 cellspacing=0><tr><td>&nbsp;" + makebutton( 'save' ) + "</td>";

 html += "<td><select class=lv id=saveformat>";

 for(var i=0;i<saveoptions.length;i++)
  html += "<option value='"+ saveoptions[i][0] + "'>" + saveoptions[i][1]
 
 html += "</select>";
 html += "</td></tr></table></td>";
 html += "<td id=printcell>" + makebutton('print') + "&nbsp;</td>";
 html += "<td id=copycell>" + makebutton('copy') + "&nbsp;</td>";
 html += "<td id=columnpickercell>" + makebutton('columnpicker') + "&nbsp;</td>";
 html += "<td id=sortcell>" + makebutton('sort') + "&nbsp;</td>";
 html += "<td id=helpcell>" + makebutton('help') + "&nbsp;</td>";
 html += "</tr></table>";

 html = '<div id=' + element.id + '.toolbar style="padding:3pt">' + html + '</div>';
 //--------------------------------工具栏结束 ----------------------------------------------

 //建立数据区域
 html += '<div id=listtable style="width:'+width+';height:'+ height +';overflow:auto" onselectstart="return false;"></div>';
 
 //listview载入框架html
 element.innerhtml = html;

 toolbar = window.document.all[element.id + '.toolbar'];
 
 //载入工具栏按钮title
 for(var btn in buttons) 
  toolbar.all[buttons[btn]].title = text[ buttons[btn].replace(/btn/,'') + 'title'];
 
 //载入数据到数组
 loaddata();
 
 //初始化navigation栏按钮事件
 toolbar.all.pagenumber.onchange = selectpage;
 toolbar.all.first.onclick = selectpage;
 toolbar.all.last.onclick = selectpage;
 toolbar.all.next.onclick = selectpage;
 toolbar.all.prev.onclick = selectpage;
 
 //工具栏按钮改变触发
 searchid.firechange();
 updaterowid.firechange();
 insertrowid.firechange();
 deleterowid.firechange();
 rowinfoid.firechange();
 pageinfoid.firechange();
 saveid.firechange();
 copyid.firechange();
 helpid.firechange();
 columnpickerid.firechange();
 sortid.firechange();
 editrowid.firechange();
 printid.firechange();
 buttonnavigationid.firechange();

 serviceavailable();
}

function serviceavailable(){
 _lvevtlistviewready.fire();
}

/**
 * 载入工具栏信息
 *
 * 从lvlang.xml文件载入工具栏信息存放在text对象
*/
function loadtext(){
 xmldoc.async = false;
 xmldoc.load("lvlang.xml");

 var nodelist = xmldoc.documentelement.childnodes;
 for(var i=0;i<nodelist.length;i++){
  text[nodelist[i].nodename] = nodelist[i].text
 }
}

/**
 * 根据按钮id从text对象里数据生成其html
 *
 * 参数:
  id: 按钮id
 * 返回:
 *  按钮html
*/
function makebutton(id){ 
 var accesskey = '';

本文关键:javascript datagrid htc listview
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top