You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
grist.ready({requiredAccess: 'full',allowSelectBy: true});consttableId="Authors";// Insert target table// Record functionsconstaddRecord=async(tableId,fs)=>{if(!tableId){alert(`Empty tableId!`);return;}if(!fs){fs={};}try{constactions=[["AddRecord",tableId,null,fs]]constresponse=awaitgrist.docApi.applyUserActions(actions);constrowId=response[0][0]grist.setCursorPos({rowId: rowId});returnrowId;}catch(error){alert(`Cannot create record [${error}]`);}};// Button functionsconstcontainer=document.getElementById("container");// Button containerconstcreateAddButton=(tableId)=>{constbutton=document.createElement("button");button.textContent="+";button.title="Crea nuovo";// Ensure the function is called with the parameter when clickedbutton.onclick=()=>addRecord(tableId);button.className="button";container.appendChild(button);returnbutton;};// Create new button, when no record availablecreateAddButton(tableId);// Listen for changes to the selected recordgrist.onRecord((record)=>{container.replaceChildren();createAddButton(tableId);});
Run the custom widget on any table.
This code fails, because response is empty.
Describe the expected behavior
response[0][0] should return the newly created record id.
So it looks to me that response.retValues[0] is what you are after. Has the format changed? @georgegevoian helped me look around for any obvious changes and we didn't come up with anything, but I'd be interested to know if code that was working for you before has stopped working.
Describe the current behavior
While developing a custom widget, when calling:
the
response
is empty.Steps to reproduce
This code fails, because
response
is empty.Describe the expected behavior
response[0][0]
should return the newly created record id.Where have you encountered this bug?
Instance information (when self-hosting only)
Grist instance:
Browser name, version and platforms on which you could reproduce the bug:
Link to browser console log if relevant:
Link to server log if relevant:
The text was updated successfully, but these errors were encountered: