var id = null;
//参照一般有两个值,一个是显示的Text,一个是id。idColumn指明id的Grid列
var idColumn = null;
var refUrl = null;
var refIdColumn = null;
var refNameColumn = null;
var extendedProp = element.extendedProperties;
if(extendedProp!= null && typeof(extendedProp) != “undefined”)
{
var dom = new ActiveXObject(“MSXML.DOMDocument”);
dom.loadXML(extendedProp);
idColumn = dom.documentElement.getAttribute(“idColumn”);
var refInfo = dom.documentElement.firstChild;
refIdColumn = refInfo.getAttribute(“idColumn”);
refNameColumn = refInfo.getAttribute(“nameColumn”);
refUrl = refInfo.getAttribute(“url”);
}
var btn = element.getElementsByTagName(“IMG”)[0];
btn.onclick = btnClick;
function btnClick()
{
var ret = window.showModalDialog(refUrl,self,’scrolling:no;resizable:no;status:no;dialogWidth:550px;dialogHeight:450px;center:1′);
if(ret != null)
{
var el = ret.documentElement.firstChild;
if(el != null)
{
input.value = el.getAttribute(refNameColumn);
if(idColumn != null && idColumn!=””)
{
id = el.getAttribute(refIdColumn);
grid.setCellValue(grid.row,idColumn,id);
}
}
}
//————————————————————–
grid.setCellValue(grid.row,”num”,100); //赋值示例
grid.setCellValue(grid.row,”price”,10); //赋值示例
//————————————————————-
}
var statusText = “”;
var input = element.getElementsByTagName(“INPUT”)[0];
input.onblur = inputOnBlur;
function inputOnBlur()
{
grid.status = statusText; //可以通过grid.status来修改Grid状态条的状态。
}
function getInput()
{
return input;
}
//该方法由SmartGrid在显示编辑器时调用。由于参照编辑器由INPUT、IMG等元素组成,所以需要告知SmartGrid在设置编辑器焦点时,应该让哪个元素获得焦点!
function focus()
{
input.focus();
}
//该方法由SmartGrid在对编辑器全选时调用。由于参照编辑器由INPUT、IMG等元素组成,所以需要告知SmartGrid在全选编辑器的内容时,应该怎样进行全选!
function select()
{
input.select();
}
function setValue(val)
{
input.value = val;
if(idColumn != null)
{
var r = grid.row;
id = grid.getCellValue(r,idColumn);
}
}
function getValue()
{
return input.value ;
}
function cellDataCheck(args)
{
return ;
}