In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly shows you the "Portal Keywords Widget can not automatically reset filter how to do", the content is easy to understand, clear, hope to help you solve doubts, the following let Xiaobian lead you to study and learn "Portal Keywords Widget can not automatically reset filter how to do" this article.
The out-of-the-box form component on the ServiceNow portal side supports Keywords search.
ServiceNow foreground Portal and backend both support keywords search (for text, query filter is' 123TEXTQUERY321='+keywords)
However, there is a problem that the system does not clear the last keywords search after each keywords search on the portal side. In other words, the second keywords search is based on the first keywords search. (unless you click the button to refresh the page, it feels unfriendly.)
How to solve this problem?
We first find the widget my Table corresponding to table in portal page (the my Table is copy from Data Table used in this example).
The search filter setting for keywords in widget is in Server script: I add comments to the code
If (data.filter) {if (data.filterACLs) gr = $sp.addQueryString (gr, data.filter); else gr.addEncodedQuery (data.filter);} if (data.keywords) {gr.addQuery ('123TEXTQUERY321 query, data.keywords); / / add keywords query statement filter to table data.keywords = null; / / each time you enter a keywords query, the contents of the input box will be automatically emptied}
This out-of-the-box code adds the keywords entered each time to the filter of the query, and sure enough, it does not clear the filter of the last entered keywords that already exists.
When So knows the reason, the fix solution is very simple. Here is a solution (if you have any other better solutions or improvements, please feel free to leave a message):
Var keyWordsIndex = 0; if (data.filter) {/ / determine whether the filter of keywords already exists in the existing data.filter. If so, remove keyWordsIndex = data.filter.indexOf ('^ 123TEXTQUERY321'); if (keyWordsIndex > 0) {data.filter = data.filter.slice (0KeyWordsIndex) }} if (data.keywords) {/ / replace the out-of-the-box addQuery method by adding filter str. If (data.filter) {data.filter + ='^ 123TEXTQUERY321 roomdata.keywords;} else {data.filter + = '123TEXTQUERY321 roomdata.keywords;} data.keywords = null } / / after creating new filter add the query filter to table if (data.filterACLs) gr = $sp.addQueryString (gr, data.filter); else gr.addEncodedQuery (data.filter)
After the above processing, you can only reset the search effect of keywords filter every time, just like in the background.
The above is all the contents of the article "what if Portal's Keywords Widget cannot automatically reset filter?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.