I updated the state field from python but the view doesn't update.
I have to refresh the page to see the update.
Related
I have a use case where I am using stack navigator. I have a homepage where I have some aggregated data and a list which are retrieved from an API.
On clicking on a list item I move to a screen which has more details of that item. There I can add entries for that item. When entries are added using a form, both the homepage as well as the item specific screen need to be updated, which means I need to call the API's again to fetch data. In case no transactions are added I was to avoid this.
What should be the best practice here? should I pass a state variable from homepage and whenever it is updated refresh the screens?
Currently, I am using a willFocus listener, and it makes an API call each time I am on one of these screens. I believe that there can be a better approach than this.
Here is my scenario. I have a main view with a datatable. That datatable has a child record that contains a partial view that is loaded when clicked. That partial view has its own button created to insert a record into the database using #URL.Action() that calls the current Action Result. My issue is that I don't need to reload the page or really have the page do anything. When I click the button I just want a simple method to fire (doesn't need to return any action result) so I can run my code to check for existing records in the database, if not create a new one and insert it. Everything I have tried either redirects the page, reloads it or creates an blank page return. I feel like I am missing some simple. I just want to call a typical method by clicking the button from the partial view that has the form data. Can someone tell me what I am missing or have I just been staring at it too long.
I am using stateSaveCallback to save a Datatables state into the database. It submits the current state via AJAX to a script so I can save the JSON.
I can attach the save function to a button click like so:
$( ".save_state" ).click(function(e) {
e.preventDefault();
table.state.save();
});
But I cannot find any documentation on how to restore or load that script using a click. The closest reference I can find is on this page
https://datatables.net/reference/api/state.loaded() which references restoring the saved state.
I am using stateLoadCallback but I think this just does it on load. I would like to do it via a click, so users can save their state in the database and click restore to load it back later (we will offer multiple state saves, like a Saved Search, so they click to restore a saved search).
Thanks
After inspecting the source code, it looks like state loading is performed only once during initialization. Therefore your best bet is to use destroy option as destroy: true and re-initialize your data table on click.
I assume you have defined a callback using stateLoadCallback option that query the server upon re-initialization.
on my single page app i have a page that the user have a select box and the data can changed according to the option the user selected.
when the data changed, i'm pushing a new state to the history
History.pushState({'id':params.id}, 'activity', '?activity');
the push works fine, the problem is when i hit 'back' the history detect that the previous state is the same ('activity') so the back doesn't work. but the data is different and i want the plugin to reload the same page but with the previous data.
I found the problem. This wasn't an issue about same state. I forgot to add preventDefault to the link that change the state.
I have a view on which two partial views are rendered.One partial view(lstContactPerson) contains the List of contacts(image and other details) and action buttons for View/Edit/Delete.On Edit button-click details of a record is rendered in another partial view(Contact) for edit. After submitting Contact form the details are updated but not an image on lstContactPerson view without reloading the page.
I have searched for this and found that issue must be of caching and i implemented most of cache removing/Disabling stuff but issue is not resolved.
try adding some random value to image url. it will ensure that image is not fetched from browsers cache
http://yourimage.png?nocache={GUID}