addRecord method of store

LabKey Support Forum (Inactive)
addRecord method of store trent  2011-06-14 23:14
Status: Closed
 
Did you try specifying an index? I was having a play around and was having difficulty until I passed the second index attribute. Oddly, it seems to work without it now, so not sure what was going on there :/

https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.ext.Store.html#addRecord

I still didn't manage to get the changes to commit though, the commitChanges function retrieves modified records (_store.getModifiedRecords) but its returning an empty array (so just returning false and not saving the new records)... I can only assume this is intended for updating existing records and not adding new records (though it does seem a bit odd having the addRecord function if you can't save said records).

You probably already know, but the Javascript API tutorial demonstrates inserting records by using the LABKEY.Query object.

Code from the first part of the tutorial which inserts records: https://www.labkey.org/wiki/home/Study/demo/source.view?name=reagentRequest

Reference to LABKEY.Query: https://www.labkey.org/download/clientapi_docs/javascript-api/symbols/LABKEY.Query.html