From the older days, we still support a jQuery widget for Metagrid. If you use jQuery anyway, this is the widget you want to use. If you don’t use jQuery, you may want to look into the vanilla js widget.
Depending on your stack, you want to install the widget over npm or download the latest version of the script from Github.
Initialize the plugin with your providerSlug
. The plugin offers two variants to use - declarative and programmatic. The following example uses the declarative approach. You pass the props for the plugin on the Metagrid element data-
attributes. data-element-kind="person"
tells Metagrid to search for a person, and data-element-id="5"
specify to fetch the person with the identifier=5.
<script src="jquery.js"></script>
<script src="dist/metagrid-widget.min.js"></script>
<script>
jQuery(function ($) {
$('#metagridWidget').metagridClient({projectSlug:'dodis'});
});
</script>
<div data-element-kind="person" data-element-id="5" id="metagridWidget"></div>
Need more examples or found an error? Check out the Github project, open an issue or send a pull request. There is also a programmatic example on the overview page