Reputation: 1147
I have a Dojo Grid. Every row has a link to the formular, where the data can be changed. Now, when I click save and close (in the form) I want the grid to reload the displayed data. So far, I've managed to reload the data, but I always jump back to the start of the grid. But, e.g. if I'm at the end of the table, I want to reload just the last few entries.
My grid is connected to a JSONRest Store, so basically I just should know the range which is displayed right now... . How do I get the range?
Upvotes: 0
Views: 4232
Reputation: 1147
I've managed to solve the problem without any put to the store. Here is the code:
grid._lastScrollTop=grid.scrollTop;
grid._refresh();
And here is the link where I've found the answer. It is the answer number 6.
Upvotes: 1
Reputation: 12182
If you have backed your grid by a store, you simply "put" the changed object to your store. The JsonRest store you are using will send the changes back to your server with a PUT request and the grid will pick up the changes and update the corresponding item.
When pressing save in your form, you would need to create a json representation of your form data (that matches the one used in the grid) and put this to the store:
require(["dojo/dom-form", ... ], function(domForm, ...) {
...
var updatedItem = domForm.toObject("yourFormId");
yourGridStore.put(updatedItem).then(function() {
console.log("put was successful");
});
...
}
Upvotes: 1