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') + " </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') + " </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> " + text['page'] + " <select class=lv id=pagenumber></select> " + text['of'] + " <input class=lv id=pagecount readonly type=text size=1></input> </td>";
}
html += "<td id=rowinfocell> " + text['rows'] + " <input class=lv id=rowcount readonly type=text size=2></input></td>";
//navigation栏结束
html += "<td id=savecell><table cellpadding=0 cellspacing=0><tr><td> " + 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') + " </td>";
html += "<td id=copycell>" + makebutton('copy') + " </td>";
html += "<td id=columnpickercell>" + makebutton('columnpicker') + " </td>";
html += "<td id=sortcell>" + makebutton('sort') + " </td>";
html += "<td id=helpcell>" + makebutton('help') + " </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 = '';