Write, Bureaucrats, Administrators
4,332
edits
mNo edit summary |
mNo edit summary |
||
Line 43: | Line 43: | ||
However, when the search may return several or many matching objects, the user must see these results and select an individual item, and then a full set of data for that item may be requested. This is analogous to the search results page of a Google or other Web search. This information hopefully gives the user enough information to make the decision to choose a single result from among others. Once the user has selected the desired item, a second request can be issued to obtain a full set of data for the individual object. | However, when the search may return several or many matching objects, the user must see these results and select an individual item, and then a full set of data for that item may be requested. This is analogous to the search results page of a Google or other Web search. This information hopefully gives the user enough information to make the decision to choose a single result from among others. Once the user has selected the desired item, a second request can be issued to obtain a full set of data for the individual object. | ||
Given this, the Memento custom data source provides for both scenarios. If the search yields a single matching object, the script may issue another request for a full set of data right away, if necessary, and call the result() function with a single argument — result(). If there are multiple matching objects, the script may return enough information to allow the user to choose the one of interest. Then, a function in the script may be called to fetch a full set of data for the selected object. | Given this, the Memento custom data source provides for both scenarios. If the search yields a single matching object, the script may issue another request for a full set of data right away, if necessary, and call the ''result()'' function with a single argument — ''result(sourceObjects)''. If there are multiple matching objects, the script may return enough information to allow the user to choose the one of interest. Then, a function in the script may be called to fetch a full set of data for the selected object. | ||
To support user selection, the necessary properties of the source object are: | To support user selection, the necessary properties of the source object are: | ||
Line 52: | Line 52: | ||
=== Additional data load === | === Additional data load === | ||
To extract all available information for an individual object, an additional source service request is needed. In this case, a function for additional data load should be passed via the result() call as a second argument — result(sourceObjects, fullFetchFunction). | To extract all available information for an individual object, an additional source service request is needed. In this case, a function for additional data load should be passed via the ''result()'' call as a second argument — ''result(sourceObjects, fullFetchFunction)''. | ||
The function call will supply one argument — the identifier previously returned for the object selected by the user. The function then returns an object containing a full set of properties, which will be loaded into the fields of the library entry according to Autofill rules. | The function call will supply one argument — the identifier previously returned for the object selected by the user. The function then returns an object containing a full set of properties, which will be loaded into the fields of the library entry according to Autofill rules. |