The extjs Jsonstore class has a method commitchanges().
Now considering that the javascript code will send an AJAX request to a servlet and not to a db directly, what do we need a commitchanges() method?
Whenever user changes anything in the form panel's or UI components that data is changed in record, but at this time record will maintain a list of modified properties in the record and store maintains a list of modified records in the store
So whenever you send a request to save the data to server, after successful save you will get back a success response, on this response store need to make sure that the saved record will be removed from the list of records that are modified in the store and also remove list of modifications from the record instance to indicate that save operation was successful
So the operations of removing list of modified properties from record instance is performed by record.commit method and operations of removing saved record from list of modified records from store is performed by store.commitChanges method which in turn will call record.commit for every record which is saved correctly on server
Related
What is the correct way to read the content of a document as value without subscription ?
Keep in mind that when persistence is enabled the Observer receives two values, first value is the locally persisted one and the second is the actual value that is stored in the database.
You can use get() method to retrieve the contents of a single document.
For More details you can check this StackOverflow thread
To notify the events on smartsheet, I have created a webhook. Using I am able to get all events performing on sheet. If I delete a record manually, I am getting the deleted event with rowid, but not the total deleted row data. Is there any way to get the deleted row data?
Thanking you in advance
The callbacks that you receive via webhooks are simply intended to notify you when events occur -- i.e., by design, each callback contains only enough data to identify the event that triggered the callback.
Update 10/19/2020:
Unfortunately, you won't be able to use the Get Row operation to retrieve data for row after it's been deleted. Therefore, seems like you'd need to somehow write/save sheet data elsewhere as the sheet is modified (e.g., perhaps in response to webhook notifications that indicate row data was added/modified?), then you could query this saved sheet data to get row data as rows that are deleted from the actual sheet (i.e., in response to 'row deleted' webhook notifications).
When we call. childAdded function initially it fetches all the records from the given link. And then after that it fetches the only newly added record.
Is there any way to prevent fetching all the data from Firebase initially.
I want to show a popup whenever a new record is added in Firebase and i want to fetch only the latest record but .childAdded first fetches all the data in Firebase.
It's not possible unless you put a timestamp value in each record. If you have a timestamp, then you can query for only the children that have a timestamp greater than the current time. Typically one uses ServerValue.timestamp() as the value of a child to automatically get the server's sense of time into that field.
I want to "reset" certain data in my database tables using a RESTful method but I'm not sure which one I should be using. UPDATE because I'm deleting records and updating the record where the ID is referenced (but never removing the record where ID lives itself), or DELETE because my main action is to delete associated records and updating is tracking those changes?
I suppose this action can be ran multiple times but the result will be the same, however the ID will always be found when "resetting".
I think you want the DELETE method
I'm creating a web API and I have a scenario where users will want to load a bunch of data in bulk, which would then be loaded into the database as multiple separate entries. This data could be brand new and thus created, or data may already exist and thus be updated. The definitions for POST and PUT seem to expect to work on only a single piece of data at a time, and the created status code reflects that in providing a location.
I already have methods that allow for a single piece of data to be created or updated. Should I write additional methods to facilitate the creation and updating of this bulk data or should I expect the user to make individual calls (perhaps hundreds of thousands of times) to load their data? What should I be returning as far as status codes and other data is concerned? Which request verbs should define these bulk calls?
The RESTful way to create multiple items inside a collection, is to use PUT on the whole collection.
This way you are making a request to replace the whole collection, so you need to pass both old and new items, but the new ones will be created by the server.
Suppose you had only one item in the /items collection called "old item". Here you request to update a collection so that it has two new items.
PUT /items
[{ Name: "old item"}, { Name: "new item 1"}, { Name: "new item 1"}]
You don't need to return any content inside a successful PUT response because success in this case means that the exact state you requested was applied. So it leaves status code 204.
And since you are updating a whole collection resource, you don't return 201 regardless of whether new items were created or not.