jQuery MiniUI

标题: 关于datagrid控制单元格类型的问题。 [打印本页]

作者: 草草草    时间: 2013-12-26 14:42:10     标题: 关于datagrid控制单元格类型的问题。

麻烦帮忙看下哪里出什么问题了?首先根据科目代号选择

[attach]3581[/attach]
利用mini.open带出核算类型
[attach]3582[/attach]
然后根据核算类型 控制这四列的单元格类型:
[attach]3583[/attach]

然后这里是仿照demo的代码
grid.on("cellbeginedit", function (e) {
                var textbox = mini.get("textboxEditor");//文本
                var buttonedit = mini.get("buttoneditEditor");//弹出窗
                var cbbh = mini.get("cbbhEditor");//成本变化下拉框
                var cbys = mini.get("cbysEditor");//成本要素下拉框
                var wlcwfl = mini.get("wlcwflEditor");//物料财务分类下拉框
                if(e.record.hslx==""||e.record.hslx==undefined){//核算类型判定
              if(e.field == "hsdx"){
                      e.editor = textbox;
                      e.column.editor = textbox;
              }
                  }
                 
                  if(e.record.hslx=="地点存货"){//核算类型判定
              if(e.field == "cbbh"){//成本变化
                      e.editor = cbbh;
                      e.column.editor = cbbh;
              }
              if(e.field == "cbys"){//成本要素
                      e.editor = cbys;
                      e.column.editor = cbys;
              }
                  }
                 
                  if(e.record.hslx=="生产成本"){//核算类型判定
              if(e.field == "hsdx"){//核算对象
                      e.editor = buttonedit;
                      e.column.editor = buttonedit;
              }
              if(e.field == "cbbh"){//成本变化
                      e.editor = cbbh;
                      e.column.editor = cbbh;
              }
              if(e.field == "cbys"){//成本要素
                      e.editor = cbys;
                      e.column.editor = cbys;
              }
              if(e.field == "wlcwfl"){//物料财务分类
                      e.editor = wlcwfl;
                      e.column.editor = wlcwfl;
              }
                  }

            if(e.record.hslx=="核算部门"){//核算类型判定
              if(e.field == "hsdx"){//核算对象
                      e.editor = buttonedit;
                      e.column.editor = buttonedit;
              }
                  }
                 
                  if(e.record.hslx=="核算现金"){//核算类型判定
              if(e.field == "hsdx"){//核算对象
                      e.editor = buttonedit;
                      e.column.editor = buttonedit;
              }
                  }
                 
                  if(e.record.hslx=="核算税收"){//核算类型判定
              if(e.field == "cbys"){//成本要素
                      e.editor = buttonedit;
                      e.column.editor = buttonedit;
              }
                  }
                 
                  if(e.record.hslx=="核算运费"){//核算类型判定
              if(e.field == "cbys"){//成本要素
                      e.editor = cbys;
                      e.column.editor = cbys;
              }
                  }
                 
                  if(e.record.hslx=="核算资产"){//核算类型判定
              if(e.field == "hsdx"){//核算对象
                      e.editor = buttonedit;
                      e.column.editor = buttonedit;
              }
                  }
                 
                  if(e.record.hslx=="核算其它"){//核算类型判定
              if(e.field == "cbys"||e.field == "wlcwfl"){//成本要素或物料财务分类
                      e.editor = textbox;
                      e.column.editor = textbox;
              }
                  }
        });


结果就是
除了核算对象这一列好使,其余三列都没反应。。
另外如下图,先点了别的行一个输入框的话,点某行也会是输入框。。。先点了别行一个buttonedit的话,点某行就是buttonedit类型。
[attach]3584[/attach]
[attach]3586[/attach]

[attach]3585[/attach]

求告知解决办法

作者: 草草草    时间: 2013-12-26 15:06:45

晕。。一只有核算对象好使是因为页面有些值被人改过了。。。
现在问题是,各种类型都显示了,但是四列所有格都能编辑。。。
作者: felt    时间: 2013-12-26 15:35:24

草草草 发表于 2013-12-26 15:06
晕。。一只有核算对象好使是因为页面有些值被人改过了。。。
现在问题是,各种类型都显示了,但是四列所有 ...

做个简单的html打包上来我们看下
作者: 草草草    时间: 2013-12-26 15:39:04

felt 发表于 2013-12-26 15:35
做个简单的html打包上来我们看下

已经找到问题了。
之前某些类型不显示是被同事改了些名字。
后来所有格都能编辑是因为e.column.editor = buttonedit;
不加的话改完值页面不显示。
加了的话一列的单元格都会变成该类型。
根据e.field加入了禁止编辑,搞定了

最近总麻烦你们,不好意思




欢迎光临 jQuery MiniUI (http://miniui.com/discuss/) Powered by Discuz! X2