Search Support
-
Mikael ErikssonJanuary 18, 2017 at 7:38 am #3506
Hi.
The table.search() function allows the caller to specify either a single column or that the search should be globally in the table.
We want to be able to search in some columns but not all. An addition where several columns can be specified would be great 🙂 Until such a thing occurs would you have some suggestion to do it with the control? (Otherwise it seems we need to do the filtering ourself on the original list and then let the table show an already filtered list.)
Regards
/Mikael E
SPARK SupportJanuary 23, 2017 at 3:53 pm #3540Hi Mikael,
The column being searched needs to be specified. Please see the documentation:
http://support.salientprocess.com/docs/enterprise/Table.html#search
The approach you have outlined for displaying a filtered table is most likely the best method.
Regards,
Stephen P.
Mikael ErikssonMarch 9, 2017 at 6:34 am #3961Hi,
The current documentation mentions that col could be a function:
When the type is “number” this is the column to be searched or null for all columns. When type is “string” this is the property name in the table to be searched. When the type is “function” this is the comparator function to use for the search. Note that when the type is function, the other parameters are ignored.
Where can I find information on how to use such a function?SPARK SupportMarch 21, 2017 at 3:54 pm #4050Hi Mikael,
The search method passes the list item into the function. To use the function, compare a property of the list to some logic, and the return the list item to be pushed to the temporary filtered list.
Lets say that I have a Business Object of myComplexType with properties str1, str2, int1 and dec1 (String, String, Integer, Decimal). I can use this function to look for integer values matching greater than 14:
function mySearch(listItem) {
if(listItem.int1 > 14){
return listItem;}
}
To filter multiple columns, modify the logic for which conditions should be returned:
function mySearch2(listItem) {
if(listItem.int1 > 14 && listItem.dec1 < 18.0){
return listItem;}
}
Regards,
Stephen P.
Stephan JanssenApril 25, 2017 at 4:14 am #4215Hi Stephen,
I’ve been trying to get this to work with a function in “Inline Javascript” of a coach view, but I can’t get it to call the function.
Can you give some more pointers on how to actually make this work?
Regards,
Stephan
Mikael ErikssonApril 25, 2017 at 5:34 am #4216Just giving the function as the first parameter to the search function in the table should work.
function mySearchFunction(row) {
if (shouldShowRow(row)) return row;
return null;
}
var myTable = page.ui.get(“tabletosearch”);
myTable.search(mySearchFunction);
-
|
You must be logged in to reply to this topic.