X5中Grid列表中的下拉列表

本文介绍如何在网格中设置下拉框,包括从常量、概念模型、静态数据及直接指定等方式加载数据,并提供绑定任意内容到单元格的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

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};
 });

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值