Easyui ComboBox 数据加载完成之后过滤数据

Easyui ComboBox 数据加载完成之后过滤数据

需求

在ComboBox 下拉框中过滤包含"物联网"三个字的选项

现状

期望

实现方式

使用 combobox 的方法在加载时过滤 loadFilter

方式一:HTML中编写

html 复制代码
<input id="enterpriseDepartmentCode" name="enterpriseDepartmentCode" style="width: 100%;height: 25px;"data-options="
                                        valueField:'id',
                                        textField:'description',
                                        editable:true,
                                        url:'${ctxPO}/json/bigorder/common/salesoffice',
                                        loadFilter: function(data){
                                            return data.filter(item => item.description.indexOf('物联网') > -1);
                                        }
                                        " class="easyui-combobox">

方式二:JS中编写

javascript 复制代码
$('#enterpriseDepartmentCode').combobox({
    valueField: 'id',
    textField: 'description',
    editable: true,
    url: '${ctxPO}/json/bigorder/common/salesoffice',
    loadFilter: function (data) {
        return data.filter(item => item.description.indexOf('物联网') > -1);
    }
});

以上都可以实现在数据加载时候完成过滤!

相关推荐
用户1733598075374 分钟前
纯前端实现PDF合并、拆分、压缩:技术方案与踩坑记录
前端
工会代表5 分钟前
frps配置,以linux服务器以及windows客户端进行远程桌面内网穿透为例。
前端
用户713874229007 分钟前
Promise 与 Async Await 深度解析
前端
董董灿是个攻城狮8 分钟前
5分钟入门卷积算法
前端
用户580481700292810 分钟前
我用 MCP 给小程序开发做了个 AI 副驾驶,开源了
前端
雨季mo浅忆12 分钟前
记录利用Cursor快速实现Excel共享编辑
前端·excel
皮皮大人14 分钟前
Vue 3 响应式内核完全解密:reactive & effect 与 Vue 2 Watcher 史诗对决
前端·vue.js
LaughingZhu14 分钟前
Product Hunt 每日热榜 | 2026-05-31
前端·人工智能·经验分享·搜索引擎·chatgpt·html
陆枫Larry15 分钟前
CSS 中「深色 + 不透明度」vs 直接设浅色的区别
前端
Din16 分钟前
使用AI从 27 秒到秒开:一次 Web 首屏加载优化实战
前端