怎么把不选改成全部

微信截图_20220808155221.png

FineReport yzm279633 发布于 2022-8-8 15:53
1min目标场景问卷 立即参与
回答问题
悬赏:3 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共4回答
最佳回答
1
snrtuemcLv8专家互助
发布于2022-8-8 16:09(编辑于 2022-8-8 16:16)

参考

var self = this; 

setTimeout(function() {

self.options.name4Empty = "全部"  ;//默认为不选 可以自定义修改

}, 100)

image.png

效果

image.png

===================

把这个代码拷贝到初始化事件中

var self = this;  

self.options.name4Empty = "全部"  ;//默认为不选 可以自定义修改

$('input',this.element).click(function(){  

    if(self.$view.css('display')=='none'){  

        self.onTriggerClick();  

    }  

}); 

//全部选择放在第一位

this.addData2View = function(c){

var e = this.editComp.val();

            var b = -1;

            if (this.$view) {

                this.emptyContent = $("<div/>");

                //默认的空添加到第一个位置

            this.initContent(this.emptyContent, this.options.name4Empty, 0);

                this.$view.append(this.emptyContent);

                 var l = document.createDocumentFragment();

                 var g = this.options.data.getLength();

               

                for (var d = g - c.length; d < g; d++) {

                    var k = d + c.length - g;

                    var h = $("<div/>");

                    l.appendChild(h[0]);

                    var f = c[k].getShowValue();

                    this.initContent(h, f, d+1);

                    if (b < 0 && f == e) {

                        b = k

                    }

                }

                this.$view[0].appendChild(l);

               

                FR.HtmlLoader.loadingMoreData({

                    el: this.$view

                });

                this._setSelectedIndex(b);

                this.fixWidth()

 }

}

this.initContent= function(b, e, d) {

            if (e == null) {

                e = ""

            }

            var c = this;

            b.height(this.options.sonHeight).attr("title", e).text(e).addClass(d > -1 ? "fr-combo-list-item" : "fr-combo-list-item fr-combo-list-item-noselect").hover(function(f) {

                c.setFocusWithIndex(d);

                setTimeout(function(h) {

                    if (!h) {

                        return

                    }

                    var g = a(h.target);

                    if (c.$view[0].style.display != "none" && g.isChildAndSelfOf(a(this).parent().children())) {

                        a(this).removeClass("fr-combo-selected")

                    }

                }, 10)

            }).click(function(f) {

                c.inList = true;

                c.fireEvent(FR.Events.CLICK);

                c._setSelectedIndex(d);//修改事件为选中当前的index

                c._onEnterPressed()

            })

        }

        this._selectWithoutTriggerEvent= function() {

            if (this.selectedIndex!=0) {

            //如果不是第一个显示值

                this.setText(this._getSelectedItem().text());

                this.inList = true

            } else {

            //否者显示空

                this.clearText();

                this.searchText = "";

                this.options.need2BuildList = true

            }

            this.checkValid();

            this.collapse()

        }

效果

image.png

  • yzm279633 yzm279633(提问者) 有全部了,但是这个全部可以放枚举值上边吗
    2022-08-08 16:12 
  • snrtuemc snrtuemc 回复 yzm279633(提问者) 可以,但是这个代码就长了,稍等看修改答案
    2022-08-08 16:13 
  • yzm279633 yzm279633(提问者) 回复 snrtuemc 谢谢您,我试下
    2022-08-08 16:21 
  • yzm279633 yzm279633(提问者) 回复 snrtuemc 解决了,可以了,太谢谢您了,已采纳
    2022-08-08 16:22 
最佳回答
0
Z4u3z1Lv6专家互助
发布于2022-8-8 15:54

where 1=1 ${if(len(下拉控件)==0,""," and xxxx")}

最佳回答
0
用户6NWif5139660Lv6资深互助
发布于2022-8-8 15:54(编辑于 2022-8-8 16:06)
最佳回答
0
重庆一棵草Lv4中级互助
发布于2022-8-8 15:59(编辑于 2022-8-8 16:00)

你用复选框不自带一个全部吗image.png

  • 4关注人数
  • 446浏览人数
  • 最后回答于:2022-8-8 16:16
    请选择关闭问题的原因
    确定 取消
    返回顶部