oFengZhongZhuiFeng
风中追风
2017-04-24 03:58

easyui 中 给datagrid 加载数据,combobox无法显示问题

  • easyui
  • datagrid
  • combo box

本身datagrid默认是编辑模式的,其中COMBOBOX没有显示加载的数据

列明生成方法

  function GetGrid(str) {

            var Cloun = [];
            var colum = {};

            //生成隐藏咧
            colum["field"] = "SB_ID";
            colum["hidden"] = "true";
            Cloun.push(colum);
            colum = {};
            //生成项目名称
            colum["field"] = "RW_ID";
            colum["width"] = "20%";
            colum["title"] = "项目名称";
            colum["formatter"] = function (value, row) {

                return row.RW_MC;
            };
            colum["editor"] = {
                type: 'combobox',
                options: {
                    valueField: 'RW_ID',
                    textField: 'RW_MC',
                    method: 'get',
                    data: RWBind(),
                     onChange: function (data) {
                        ChangesxlxLIST(data);


                    }

                }
            };
            Cloun.push(colum);
            colum = {};
            //生成事件类型
            colum["field"] = "SJLX_ID";
            colum["width"] = "10%";
            colum["title"] = "事件类型";
            colum["formatter"] = function (value, row) {
                return row.SJLX_MC;
            };
            colum["editor"] = {
                type: 'combobox',
                options: {
                    valueField: 'SJLX_ID',
                    textField: 'SJLX_MC',
                    method: 'get',
                    data: []

                }
            };
            Cloun.push(colum);

            colum = {};
            //生成事件类型
            colum["field"] = "GZLX_ID";
            colum["width"] = "10%";
            colum["title"] = "工作类型";
            colum["formatter"] = function (value, row) {
                return row.GZLX_MC;
            };
             colum["editor"] = {
                type: 'combobox',
                options: {
                    valueField: 'GZLX_ID',
                    textField: 'GZLX_MC',
                    method: 'get',
                    data: GZLXBind(str),
                    onChange: function (data) {
                        ChangeJF(data);


                    }

                }
            };
             Cloun.push(colum);


             colum = {};
            //生成事件内容
             colum["field"] = "SBSP_NR";
             colum["width"] = "29%";
             colum["title"] = "事件内容";
              colum["editor"] = "textbox";
              Cloun.push(colum);

              colum = {};
            //生成事件内容
              colum["field"] = "SBSP_ST";
              colum["width"] = "8%";
              colum["align"] = "center";
              colum["title"] = "开始时间";
              colum["editor"] = { type: 'datebox' };
              colum["formatter"] = formatDatebox;
              Cloun.push(colum);


              colum = {};
            //生成事件内容
              colum["field"] = "SBSP_ET";
              colum["width"] = "8%";
              colum["align"] = "center";
              colum["title"] = "结束时间";
              colum["editor"] = { type: 'datebox' };
              colum["formatter"] = formatDatebox;
              Cloun.push(colum);



              colum = {};
            //生成事件内容
              colum["field"] = "SBSP_WORK";
              colum["width"] = "5%";
              colum["align"] = "center";
              colum["title"] = "工作量";
              colum["editor"] = { type: 'numberbox', options: { precision: 1 } };
              Cloun.push(colum);



              colum = {};
            //生成事件内容
              colum["field"] = "SBSP_SCORE";
              colum["width"] = "5%";
              colum["align"] = "center";
              colum["title"] = "积分";
              colum["editor"] = { type: 'numberbox', options: { precision: 1 } };
              Cloun.push(colum);

              colum = {};
            //生成事件类型
              colum["field"] = "SBSP_WCD";
              colum["width"] = "5%";
              colum["title"] = "完成度";
              colum["formatter"] = function (value, row) {
                  return row.val;
              };
              colum["editor"] = {
                  type:'combobox',
                  options:{
                      valueField:'text',
                      textField:'val',
                      method:'get',
                      data:overD
                  }
              };
              Cloun.push(colum);
              $('#dg').datagrid({ columns: [Cloun] });

        }

数据加载模块

  if (retVal.length>0) {

                    for (var i = 0; i < retVal.length; i++) {
                        var data = {};
                        data["RW_ID"] = retVal[i]["RW_ID"];
                        data["SB_ID"] = retVal[i]["SB_ID"];
                        data["RY_ID"] = retVal[i]["SB_RY"];
                        data["RY_MC"] = retVal[i]["RY_MC"];
                        data["SBSP_ST"] = retVal[i]["SBSP_ST"].toCHString(false);
                        data["SBSP_ET"] = retVal[i]["SBSP_ET"].toCHString(false);
                        data["JRRY"] = retVal[i]["JRRY"];
                        data["SJLX_ID"] = retVal[i]["SJLX_ID"];
                        data["SJLX_MC"] = retVal[i]["SJLX_MC"];
                        data["SBSP_NR"] = retVal[i]["SBSP_NR"];
                        data["GZLX_MC"] = retVal[i]["GZLX_MC"];
                        data["SBSP_WCD"] = retVal[i]["SBSP_WCD"] + "%";
                        data["WORK_ID"] = retVal[i]["WORK_ID"];

                        data["SBSP_WORK"] = retVal[i]["SBSP_WORK"];
                        data["SBSP_SCORE"] = retVal[i]["SBSP_SCORE"];

                        data["ZGID"] = retVal[i]["ZGID"];
                        data["ZGMC"] = retVal[i]["ZGMC"];
                        data["XGID"] = retVal[i]["XGID"];
                        data["XGMC"] = retVal[i]["XGMC"];


                        dataDgData.push(data);
                    }




                    $('#dg').datagrid('loadData', dataDgData);

图片说明

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答