如何以编程方式将值输入到devExtreme列表搜索框中,并像往常一样触发过滤列表的事件



这里有DevExtreme用户吗?我有一个值需要输入到dxList搜索栏(而不是通过用户输入(,我想要的是设置搜索栏文本框值并相应地过滤列表,我在哪里可以配置它?我的意思是搜索栏必须有id,对吧?在哪里可以找到searchBarId和如下代码?

document.getElementById("searchBarId").value = "ABC";

我试图通过以下方式获取HtmlCollection:

var textContainer = document.getElementByClassName("dx-texteditor-input-container")[0];

然后一旦我得到它,我设置值

textContainer.value = "ABC"

该值已设置,但未触发筛选器函数。我需要手动调用筛选函数吗?如何做到这一点?谢谢你的评论。

我建议在dx-list实例上使用option(optionName, optionValue)方法来设置searchValue属性。

示例:

var listWidget = $("#list").dxList({
dataSource: products,
searchEnabled: true,
searchExpr: "Name",
displayExpr: "Name"
}).dxList("instance");
listWidget.option('searchValue', 'my search input');

相关内容

最新更新