- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
下面是填充了用户数据的 filteringSelect 示例。我的目标是对显示的值执行通配符匹配。例如,如果用户键入“son”,则下拉匹配项将是“homer simpSON”和“carl calSON”。默认情况下,匹配只会出现在标签的开头。
我尝试更改 dijit.byId('userselect').searchAttr,但将其设置为字符串以外的任何内容会导致错误行为。
<input id="userselect">
<script type="text/javascript">
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojo.data.ItemFileReadStore");
var user_data = {
"itentifier":"user_id",
"label":"label",
"items":[
{"first_name":"Waylon","last_name":"Smithers","label":"Waylon Smithers","user_id":7}
,{"first_name":"Carl","last_name":"Carlson","label":"Carl Carlson","user_id":6}
,{"first_name":"Homer","last_name":"Simpson","label":"Homer Simpson","user_id":4}
,{"first_name":"Lenny","last_name":"Leonard","label":"Lenny Leonard","user_id":5}
,{"first_name":"Montgomery","last_name":"Burns","label":"Montgomery Burns","user_id":8}
]
};
dojo.addOnLoad(function() {
var userStore = new dojo.data.ItemFileReadStore({
//url: "/user/lookup",
data: user_data
});
var filteringSelect = new dijit.form.FilteringSelect({
id: "userselect",
name: "userselect",
store: userStore,
searchAttr: 'label' //["first_name", "last_name", "oasis"]
},
"userselect");
});
</script>
最佳答案
您需要设置 queryExpr
并将 autoComplete
设置为 false
var filteringSelect = new dijit.form.FilteringSelect({
id: "userselect",
name: "userselect",
store: userStore,
searchAttr: 'label',
queryExpr: '*${0}*',
autoComplete: false
},"userselect");
queryExpr
的 Dojo 文档:
This specifies what query is sent to the data store, based on what the user has typed. Changing this expression will modify whether the results are only exact matches, a "starting with" match, etc. dojo.data query expression pattern. ${0} will be substituted for the user text. * is used for wildcards.
${0}*
means "starts with"
*${0}*
means "contains"
${0}
means "is"
关于javascript - 如何配置 dojo.FilteringSelect 以匹配通配符值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2805497/
如何安装 DOJO 工具包并在我的网站上使用它?有教程吗? 最佳答案 是的: http://docs.dojocampus.org/quickstart/gettingstarted “Dojo 现在
我对 Dojo 的文档感到很困惑。如何在不实际使用 dojo.declare() 的情况下使用 dojo.require()?我不想使用 dojo.declare() 的原因是它将声明的类公开为全局变
我是 Dojo Toolkit 的新手,今天我遇到了这个话题 dojo.mixin()和 dojo.extend() . 我想两者都习惯于从另一个对象获取一个对象的属性。 谁能解释一下 dojo.mi
我的问题是:我们可以使用 dojo.xhrPost 发布一些 Json 数据吗?更多详情: 我一直在尝试使用 Dojo 代码将 JSON 数据发布到 RESTful 服务。似乎是的行为dojo.xhr
我有一个从XMLStore读取的DataGrid。 DataGrid中大约有2200行。每次我滚动表格时,都要花费几秒钟来显示数据。似乎一次只检索了几行(20-25)。有没有办法一次检索所有行? 最佳
在将请求发送到服务器以获取 AMD 模块之前,是否可以修改 dojo AMD 加载程序使用的请求 url?我想附加一个带有版本号的请求参数。 我们试图解决的问题是我们希望浏览器缓存我们的 javasc
当我使用自定义构建的 dojo 时,dojo.currency.format 没有使用正确的货币符号。 这是我使用的语句: dojo.currency.format(1234.567, {curren
我创建了一个非常简单的模板化小部件。像这样的东西: function (declare, _WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin,
如何在 dojo 数据网格中显示复选框? 最佳答案 我建议将 cellType 设置为 dojox.grid.cells.Bool,而不是格式化程序。格式化程序为您提供了很大的自由,但也有责任在之后从
收到新信息后,我无法尝试更改数据网格的结构。每次进行查询时,我都需要能够更改列数。 我用来创建网格的 javascript 代码 function setgrid(){ var gridLay
试图找出为什么我似乎无法在我的 dojo 构建中实习字符串。我的图层文件已正确创建,但与每个单独的 dijit 关联的代码未正确嵌入。 这是构建输出的一部分,说明了失败的地方: release: I
我刚刚开始使用道场,我知道 dojo.query与 $ 相同在 jQuery 中。 但我还没有弄清楚它返回什么。它是像 jQuery 一样的专门对象吗? 我正在尝试做的(没有运气)是: dojo.qu
有什么方法可以将按钮 添加到TitlePane 标题(标题栏右侧),以便我可以执行一些操作(下载、删除...) 提前致谢。 最佳答案 dijit TitlePane 标题包含以下内容 -Rule
在使用 dojo 的 gfx 渲染文本时,有没有办法告诉文本将占用多少空间,以防我需要包装它以使其适合给定的宽度? 如果您必须使它们适合宽度受限的区域,您将如何管理打印任意长度的文本? 更新 :对不起
我对 Dojo 工具包有点陌生。有些问题我想得到启发(我用谷歌搜索,但没有得到任何合适且令人满意的答案) 我已经在运行的应用程序(由另一个软件开发人员开发)中有一个 dojo.js(也许是下载的未压缩
我正在使用 dojo 柱形图。我想添加一条绘制在绘图上的自定义线(某种阈值线)。所以,假设 y 轴的范围从 0 到 5。我想要一条水平线,比方说,4.2 横跨绘图。它是一个柱形图。我希望找到一些可以帮
我在设置 dojo 时遇到问题. dojo 中定义的任何内容配置似乎使用 localhost:8080/Scripts/foo.js 正确加载小路。但是,如果我尝试在没有这个的情况下加载模块,请说:
我正在为一个项目使用 Dojo 1.9,但我不明白 dojo.provide 的正确替代方案与传统风格相比,AMD 风格。我正在阅读 this文档页面。 很明显,这就是旧语法映射到新语法的方式: 旧
我们正在使用 Dojo 1.9 运行我们的应用程序的构建,而构建本身需要过多的时间才能完成。某处沿着 10-15 分钟的路线。 我们的应用程序无论如何都不是很大。也许 150K LOC。没有什么花哨。
在我的 Dojo 构建中,我引入了一些第三方库。 当我完成构建过程时,由于 ReferenceErrors,我收到了错误。 这很好。这是有道理的。 但是,我想告诉 Dojo 构建过程所引用的内容。本质
我是一名优秀的程序员,十分优秀!