Enable Full Text Search on Web app
on the web app, there is a standard search box at the top of the screen. You can define a custom search function which will be called by UpviseJS in your app to implement search
- At the top of your app source file, add this statement: Config.onsearch = "mySearchFunction" , where mySearchFunction is the name (string) of your custom search function
- Implement a search function, with one string parameter named search function mySearchFunction(search) {...}
- You can use Query.search() method to implement it. This method will returns all records in a given table matching a given search string.
Config.onsearch is only used on web app, it is ignored on mobile app.
Config.onsearch = "mySearchFunction";
Config.tables["tasks"] = "id;name;description;status INTEGER;owner;date DATE";
...
function mySearchFunction(search) {
var where = "status=1";
var tasks = Query.search("tasks", search, "name;description", where);
List.addItemTitle(tasks.length + " Search Results");
for (var i = 0; i < tasks.length; i++) {
var task = tasks[i];
List.addItem(task.name, "viewTask({task.id})");
}
List.show();
}