When saving/deleting data, I sometimes would like to show feedback to the user when the save/delete action is performed by the server (I use a JSON RestDataSource). As an example, I could think of a employee reporting hours per day and after a save action I could show a dialog with the total hours in the month.
What kind of event/callback mechanism would I use? I am thinking about transformResponse in the data source and using extra meta data. For a create or update action, this could be:
For a delete action, it's something like this:
The reason I choose transformResponse is that it seems to be triggered for all data operations (fetch, add, update, delete) and it is widget independent: it works for a form and a editable grid.
My objections to this approach is that a data source doesn't feel like the right place to update visual components.
Any thoughts or ideas?
Thanks in advance.
What kind of event/callback mechanism would I use? I am thinking about transformResponse in the data source and using extra meta data. For a create or update action, this could be:
Code:
response: {
status: 0,
data: {
id: 1,
name: 'John Doe',
date: '2010-09-16',
hours: 5
},
hours_per_month: 100
}
Code:
response: {
status: 0,
data: {
id: 1
},
hours_per_month: 95
}
My objections to this approach is that a data source doesn't feel like the right place to update visual components.
Any thoughts or ideas?
Thanks in advance.
Comment