Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
dev:client_coding:javascript_api [2018/09/09 05:08]
zuphilip [API Methods]
dev:client_coding:javascript_api [2018/09/16 13:23] (current)
zuphilip [Managing citations and bibliographies] fix and expand related items
Line 341: Line 341:
 the Zotero database. ​ This includes items and notes. the Zotero database. ​ This includes items and notes.
  
-<code javascript> ​ var related_items = item.relatedItemsBidirectional ​</​code>​+<code javascript> ​ var related_items = item.relatedItems</​code>​ 
 + 
 +==== Set two items as related to each other  ==== 
 + 
 +Given two items ''​itemA''​ and ''​itemB''​. We can set them as related items 
 +to each other by using the ''​addRelatedItem''​ function: 
 + 
 +<code javascript>​itemA.addRelatedItem(itemB);​ 
 +await itemA.saveTx();​ 
 +itemB.addRelatedItem(itemA);​ 
 +await itemB.saveTx();​</​code>​
  
-This returns a list of items just like in the search examples. 
  
 ==== Get an Item's Attachments === ==== Get an Item's Attachments ===
dev/client_coding/javascript_api.txt · Last modified: 2018/09/16 13:23 by zuphilip