grid(列表中下拉框设置)
grid列回调时使用下拉列表(将概念中的属性fF2的type设置为html并加上该属性的onRender事件):
function grdMainFF2Render(event){
//数据来自常量的参数配置中
var fF2 = pmcCoreSystem.getConstValue("fF2");
return pmcCoreSystem.bindGridCellAsComboBoxWithBaseCodeType(event.cell, event.value, "P000", null);
//2数据来自某个概念模型中
var sqlCmd = {
dataModel: "/system/data",
valueTemplate: "[this.a]-[this.b]",
nameTemplate: "[this.b]---[this.c]",
sql: "select sid as a, sname as b,scode as c from sa_opperson where rownum < 5",
mapping: "a,b,c"};
return pmcSystem.bindGridCellAsComboBoxForSQL(event.cell, event.value, sqlCmd, {toggle: true});
//3数据来自静态数据,title:中的内容是下拉框中通的提示信息
return pmcSystem.bindGridCellAsComboBox(event.cell, event.value, function(){
return [{name: "是", value: "1", title: "您同意"}, {name: "否", value: "2", title: "您不同意"}];
}, null);
//4数据来自静态数据
return pmcSystem.bindGridCellAsComboBox(event.cell, event.value, "1=是,2=否", null);
}
这是bind任意内容的函数:
return pmcSystem.bindGridCellHTMLComponent(event.cell, event.value, function(container, onSetValue){
var ipt = document.createElement("INPUT");
ipt.__onValueChanged = function(value, onGetValueByColId){
this.value = value;
};
ipt.onblur = function(){
onSetValue(this.value);
};
container.appendChild(ipt);
return {onValueChanged: ipt.__onValueChanged, context: ipt};
});
更正:
//5---
return pmcSystem.bindGridCellHTMLComponent(event.cell, event.value, function(container, value, onSetValue){
var ipt = document.createElement("INPUT");
ipt.__onValueChanged = function(value, onGetValueByColId){
this.value = value;
};
ipt.onblur = function(){
onSetValue(this.value);
};
container.appendChild(ipt);
return {onValueChanged: ipt.__onValueChanged, context: ipt};
});