how to do a typeahead in domino volt using js or volt javascript syntax ?
Hi, Really glad you asked that question, Coly Junior, I was going to ask a similar question, so here's mine so that hopefully someone can answer it at the same time:
I've been doing some exploratory work on how we might use Volt but with large datasets. For example, say the HCL sample Deal Tracking app, except instead of a table displaying a handful of deals, imagine doing a retrieve of a separate Domino database with, say 50,000 "deals" (or products, or whatever). With such a large dataset, how would someone find the record they were looking for? So in the sample app, there are drop-downs that allow the user to filter on certain categories - ok, fine for starters, but maybe not so good for much larger data sets. In Notes, they'd use the Search bar - maybe with wildcards. In Javascript we could have a type-ahead as Coly Junior is asking for.
I tweaked that sample app so that I had a single field in there to do a retrieve instead rather than a drop-down. It works fine for a search on "Snow Sports" but no "Snow". OK I need to do a bit more work on that but in general Coly J and I are probably trying to do the same thing which is search for things other than having drop-down filters. Any ideas would be appreciated.
One answer is to use the Dojo FilteringSelect function. Here's a link to an example.
All the JS is in the HTML fragment onShow. It takes an array lets you type ahead to make a selection. An onChange listener triggers the values being passed to two volt fields.
thank you very much Marty
but now I would like to listen to a service coming from base notes to map some values that it returns to me in volt fields ?
i.e. instead of an array for the typehead how I could map data coming from a service as if it was an API which returns the data to me in format JSON ?
what do you suggest to me ?
I figured that would be the next question :-). I've updated the example app to work with a service. Its a bit of a hack but it works!
I use a service to populate a dropdown. With a listener I wait for the service to complete and then
- Get the dropdown options - e.g. page.F_DropDown1.getOptions()
- Convert it to a string
- Replace title with name and value with id
- Convert it back to a JSON object.
- Give the dojo filterSelect the dojo object for input
Should work for any service that you can map to a drop down.
thanks very much it's work for me too :-)
What example app is it in please?
I have tried to adapt the user lookup example for part entry looking up a notes database but just cannot get it to work.
I have never really used JSON so am probably missing something that I do not fully understand
Hi I am trying to use this idea.
How one earth do you get a column from a view into a dropdown?
Is it possible via list view in a service?
yes it is possible via list view in a service
you can download and test this app
https://leapsandbox.hclpnp.com/VoltFIles/DojoFilterSelect.volt
I am assuming a Domino View. If so Yes this is possible. I've done with both List View and List View Categories.
Just pick off the values you want and map them to the display and value.
Thanks you both
I have just spent a couple of hours trying to get a list view to work but whilst creating the service it just sat there when I clicked OK and I have no idea what was wrong. It seemed like I could not allocate the same column to both display and saved value of the dropdown.
Gary,
on the Notes side, the first column of the view needs to have the property to sort by the column ticked - please note, it is not just the default sorting. The tick box below.
Next you create a service from a domino database, choose the database, the view and then you need to configure input and output as you'd do it for other services, wiring the variable in the view to the variable where the pull-down will appear