if i did some edits on data via functions on objects in tables are still the old data.
Only after Browser refresh the changes are visible.
Data is coming via Slate JavaScript Functions from Platform.
Is there a way to refresh this data shown in widget table?
The Object Set integration in the Slate Platform tab is backed by the Object Set Service search endpoint. This endpoint in turn hits the underlying index in the Phonograph data store associated with the object type.
When you make a data change via an Action, there is a brief (normally less than 3s) delay before the changes are reflected in the index. They're immediately reflected if you access the modified object(s) by primary key.
So in Slate you can set up an Event "chain" based on the success event broadcast from the Action, through a Toast Widget with a 3-4s timer, to an event that triggers on w_toastWidget.didClose -> s_myObjectSet.run.
This should tell Slate to update the object set 4 seconds after the successful submission of the Action.
A future planned update to the Object storage infrastructure will provide a version of Actions that guarantees when the request returns successfully that the changes will already be reflected in search results.
Related
I have a notification icon in my web app that shows the number of notifications. The front end of the application is made using angularjs.
The count for the icon is stored in a $rootScope variable. I want to increment the variable(or call a web service that returns count) when a push notification is received.
The serviceworker.js file does not have access to the scope variables in angularjs. How do I change the count variable's value from the serviceworker.
I thought of adding a change event listener on localStorage item.
On logging in, I will create a item.
localStorage.setItem('notifCount', 0);
When I receive a push notification, I will increment notifCount in localStorage in serviceworker.js and the change event will fire. I could add the localStorage change listener in one of controller files and call a web service or just increment the $rootScope variable.
But this would happen even when someone manually changes the localStorage in dev tools.
I want to know if I can do it this way(if it's the right way) or is there a better method. I don't feel like this is the right way.
Data is sent between workers and the main thread via a system of messages — both sides send their messages using the postMessage() method, and respond to messages via the onmessage event handler (the message is contained within the Message event's data attribute.) The data is copied rather than shared.
For more information, see
MDN Web API Reference - Using Web Workers
Is this possible?
To know data changed by other users in realtime without requery or refresh on MS Access.
I'm developing user forms in HTML & Javascript and using MS Access as back-end DB.
Three or four users always keep opening the form.
I want to refresh and display other user's changes into the form in real-time, like SQLserver's SqlNotificationRequest or Ajax with php.
I allowed only using MS Access and HTML with JS on intranet, due to an authority.
Is there no way but using timer function with refresh or requery in JS?
You can't do it in real time; you will have to fake it. Decide what is an acceptable lag in the information update (5 seconds? 30 seconds?) and set up a timer on your front end.
When the data is modified on your database is there logging/audit? Do you keep a timestamp? If yes, you can use that to check for new changes. If not, just create a single record, single field table to store the last modification timestamp. Or if you have a generic parameter or global values stable, add one more record there. Make sure anything on your front end that alters data updates this timestamp field.
Then your front end's timer function can check the last update timestamp and compare it with its own last update timestamp (which you stored locally on the previous timer event) and see if it needs to refresh the data or not.
I'll be as direct and as specific as possible.
I'm trying to create Greasemonkey addon that would create graph of winnings/loses on: dead link
As you can see, site has front page which dinamicly shows results of wins / loses and how much did which user win/loose. What I'm trying to do is catch every new entry so I can draw some grapsh and or statistics for user / users.
When I access div/span that should have data, it turns out to be empty. I know that reason behind this is that all divs with data relevant to me are empty on load and that they get populated later on.
What I don't know is how to access that data. I can see (using firebug console) that there are GET requests executed all the time and that in those get requests is data that I need.
Can someone tell me or at least point me into right direction, how to access that data every time it gets refreshed / inserted?
You can try using the $.ajaxSuccess function to specify a function in your script to be called everytime an ajax request completes in the main page. This'll be fired for every successful ajax request, whether it pertains to the data you're talking about or not, but should allow you to re-scrape that section of the document to grab any and all data in it after every successful request. You may want to wrap your callback function in a setTimeout of some kind to make sure their own callbacks have a chance to fire and inject/modify the content before you scrape it. It should still seem instantaneous to the user if you set a timeout of, say, 1-10ms.
http://api.jquery.com/ajaxSuccess/
I would like to setup and undo feature that delays my ajax call a set amount of time and gives the user an opportunity to abort the ajax call before it gets called. I would also like to stop the delay and continue with the most recent ajax call if another action is triggered.
For example,
If i sent an email and I'm given 5 min to undo this action, I can send another email to send the previous email and to give this new email 5 min to undo.
I was wondering how I would be able to do this?
You can try to encapsulate the actions and show use the pending actions which use can commit by clicking a button. This way they can any time remove the pending action.
Another way is to create undo action (like if a block of text is deleted, keep the deleted text with position information) that can be executed later to bring system back to previous state.
But if it is something like email sent or data saved to database things get complicated and queuing up pending changes is a better way.
There is an undo/redo module for YUI library which you can explore.
Here is some pseudo-code:
User clicks to send
If there is a previous one saved ...
clear the timeout away
call the send function which will ...
retrieve the saved one
if it hasn't been erased ...
erase the saved one
call ajax to send it
Save the current one away
set the timeout to call the send function (defined above)
Note that "saving" and "retrieving" is simple here. Store it to the 'savedEmail' variable and get it from there. Erasing means you set the 'savedEmail' variable to null.
I have been finding ways around this for a long time but think it's time I addressed it.
If I have a page that has a dropdown menu, is there anyway I can select a value which will subsequently load other values further down.
Can this be done without a page reload?
I will give you an example.
Say I was making some tools for an admin panel, but first of all they needed to select a member to work with.
They would select the member and then below, the fields about that member would be populated based on what was selected in the first menu.
As I have already asked, can this be done without a page reload?
Thanks for reading.
Yes it can be done without AJAX. When the page is rendered pass all the collections that will be used by the dropdown lists as JSON objects into the HTML:
var collection = [{ id: 1, name: 'John' }, { id: 2, name: 'Smith' }];
...
Then register for the change event of the first drop down and based on the selected value go and fetch the data from the other collections. Of course if you have lots of data this might not be practical as your pages will become very large and in this case AJAX woulld be more appropriate.
Answer YES it can be done.
Firstly you'll need an event, in this case you need to take action on the onChange event for the selectBox. So when an item changes you run a function.
Now you have 2 choices. You can do this using AJAX or NOT, it really depends on the complexity / security of your application.
In the following I refer to
Users : those using the application
Hidden Client Side Data : Data sent to the client during page load, but not visible to all users, however using view source, or downloading JS files, the Data is not secured.
Method 1 - NO AJAX
Basics: You send all the possible display options down initially when the page is first loaded, but display only the sections relevant to the user during selectbox onchange events.
Recommended when: No security condiderations if hidden client side data is detected (or won't be detected, or you simply trust your audience to use the app in the intended manner). Lastly when your total view permutations are low.
Method 2 - AJAX
Basics: You send down initially only the page skeleton, when the user changes the value of the select box, you then do an AJAX request to the server - grab the new view info thats relevant to that user, send it back down to a script which will inject that user data into the DOM.
Recommended when: You have a public site, or a site where security is a consideration. Where you have lots of view permutations or want more customizations per user than in scenario 1.
As you see both methods do not require a repost - method 1 ships everything upfront, method 2 uses AJAX to fill in data when required. Both methods are valid depending on your requirement.
Yes. Ajax is mainly used for that i.e. (without a page reload)
You have to use following step to achieve
Create a link and call a JavaScript function on it's onchange function
In the JavaScript function you have to call Ajax request.
Update the div in your ajax response.