判断参数隐藏控件提示getValueofundefined

下面这段提示错误

var type;

type = _g().getWidgetByName("type").getValue(); //获取报表主体控件的控件值

var d = this.options.form.getWidgetByName("data_date");

var w = this.options.form.getWidgetByName("data_week");

if (type == "日") {

d.setVisible(true);

w.setVisible(false);

} else if(type == "周"){

d.setVisible(false);

w.setVisible(true);

} {

d.setVisible(false);

w.setVisible(false);

}

image.png

FineReport lincoder 发布于 2022-10-26 10:02
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共2回答
最佳回答
0
CD20160914Lv8专家互助
发布于2022-10-26 10:06

改成这样试一下看看呢?

var type =this.options.form.getWidgetByName("type").getValue()

var d = this.options.form.getWidgetByName("data_date");

var w = this.options.form.getWidgetByName("data_week");

if (type == "日") {

d.setVisible(true);

w.setVisible(false);

} else if(type == "周"){

d.setVisible(false);

w.setVisible(true);

} {

d.setVisible(false);

w.setVisible(false);

}

最佳回答
0
用户k6280494Lv6资深互助
发布于2022-10-26 10:06(编辑于 2022-10-26 10:07)

WorkBook13.rar

参考

或者试试这样

setTimeout(function() {

var type;

type = _g().getWidgetByName("type").getValue(); //获取报表主体控件的控件值

var d = this.options.form.getWidgetByName("data_date");

var w = this.options.form.getWidgetByName("data_week");

if (type == "日") {

d.setVisible(true);

w.setVisible(false);

} else if(type == "周"){

d.setVisible(false);

w.setVisible(true);

} {

d.setVisible(false);

w.setVisible(false);

}

}, 500)

  • 3关注人数
  • 188浏览人数
  • 最后回答于:2022-10-26 10:07
    请选择关闭问题的原因
    确定 取消
    返回顶部