How do you set the start page using a server side data source - ag-grid

Using angular and a server side data source, I want to be able to load the grid at a specific page number. This will help me support the user using the back button as they go from list pages (aggrid) to detail pages.
I've discovered paginationGoToPage() but it doesn't seem to work in onGridReady, it only works if i use it on a button click. But even if I do use it, it seems like the data would have to be loaded twice, once when the grid is first rendered and then again for the particular page I want to go to.

Related

GWT, programmatically get the same effect of a hyperlink

So some background, I am working in GWT, using MVP and activities and places. So I have all my stuff working with hyperlinks, and places are changing. I am also using a PlaceController.gotTo(Place).
Now what I want to do is be able to send the person to another place but programatically. Right now with the setup GWT manages the converting of the url into a place, and then fires the activities from that, but what I would like, is to either convert a url to a place, using the same way gwt does it or change the url, and fire a history changed type of effect onto the site.
What I don't need is an anchor to reload my whole site, I just want to feed a string into something and get the whole place change situation moving.
I want the effect of a hyperlink.
I'm not sure I understand exactly what you're trying to do, but PlaceHistoryMapper is the only tool that GWT uses: feed a String to getPlace and it gives your the corresponding place. Alternately, you could use History.newItem (note that contrary to PlaceController#goTo, if the user cancels the PlaceChangeRequestEvent, the URL would have already changed).

Passing data from one screen to another screen in iPhone using phone gap

I have just started to look into the phone gap.I have created one basic form which taking the data of the employee.I have table view in another screen .I want to pass the employee details to the second screen .I was googling for this purpose.I have found that there are some ways to do this like:
1.Server side post back
2. Client side URL examination
3.What's in a window.name = local cross-page session
4.HTML5 local storage
5. Cookies
But will my phone gap application be 100% native by using these ways? Is there any alternate way or tutorial to pass the data between the screens?
What you actually mean by "a screen"? If you're talking about a pop-up dialog box or page by jQuery Mobile you can probably serialize the form with jQuery and assign it to a JavaSCript variable.
But if you're changing your "screen" by changing UIView to a different url you can use either:
File API to store serialized form in a file and load it on the 2nd "screen"
Storage API to ... actually do the same
I'd go for number one, as it's easier to implement than using SQL and writing loads of additional code.
Search for:
jQuery.serialize()
PhoneGap File API

How to refresh parts of page when database changes?

I want a better way to update images on a webpage instead of forcing the webpage to refresh every 60 seconds.
I wrote a little status page that monitors some of our web sites. It uses web.py and displays a list of servers I have inputted into a database.
Each server that is up gets a Green png image displayed next to it.
When a server goes down I update the status in a local mysql database to false.
The next time the page refreshes it gets a red png displayed next to it.
Right now that red png file does not display until I refresh the page.
Is there a way in web.py (python) that I can make just that image dynamic without having to refresh the whole page? Or do I have to use something else to make it work?
Well, the generic answer is that you use AJAX and put a script on each server that will return "up" or something every time your page checks.
Here's a tutorial on how to do AJAX with web.py specifically: http://kooneiform.wordpress.com/2010/02/28/python-and-ajax-for-beginners-with-webpy-and-jquery/
I have no knowledge related to web.py.
But in my point of view what you gonna need is to break your code in two parts (a monitor service and a monitor display) and use javascript to asynchronously update the data.
Your monitor service will provide a url that receives the monitored site ID and returns up or down. As you are using web.py, it will probably be 100% python.
Your monitor display will use javascript to ever X seconds checks that url and show the correct icon. It can be python based, or not. But it will need javascript.

Pattern for Spring-MVC stateful interaction

Today I was doing this thing with Spring:
Have a page with a form and a chance to choose one item related to the form.
If you push "Choose item" the app will save somehow what you typed in the form, go to another page, let you choose the thing.
When you are back to the form it's filled with what you wrote before going to the other page, plus the item chosen.
Seems easy, but you have to take into account that for some stupid reason the user could open the page where you choose the item (maybe because of a bookmark, or because he pressed the back button 10 times to play). You know what I mean. I tried many ways, mainly based on HttpSession... I don't like any of those. None of them seems elegant. I was even thinking of using a hidden form in the other page, but given that it is not unique to this "flow" (I mean you can go to the item choose page from others as well), I will have to worry about conflicts and so on.
So what would be the preferred way for you? Suggestions?
Go around the problem instead of solving it. You can use a modal javascript div popup where the user can pick the item she wants. The contents of this div can be loaded via ajax (separate Spring MVC controller called with Http GET). Once the selection has been made, you close the popup (hide the div) and copy the value into the original form. Done.
No need to store the state anywhere.
I suggest Spring Web Flow.
Spring Web Flow compliments the Spring MVC.
Here is link to Spring Web Flow Demo

Go to a new page, but still have GWT variables?

In GWT, I would like to do something like a form submission that takes me to a new page, with new style sheet and new static elements, and when I get there, be able to extract the values of GWT variables still in GWT. In other words, I want to do most of the form processing on the client side instead of sending it to a servlet to be processed and sent back. Is that possible? Would FormPanel allow me to do that? How do I access the contents of the form fields in GWT on the new page?
I'm not sure I'm getting the right picture here, but I see several possibilities:
Pass the variables in the url like example.com/myform#create/param1/param2 or any other format you want, then read it using the History class
Use something like this - create an iframe from GWT (maybe put it in Lightbox or something similar), populate it the way you want using the current state of the app, and when the user is finished, he'll just close the (Lightbox) frame and get back to the main application
You could also pass around data in a "hidden" way (no visible data in the url or even through POST) using the window.name hack - there's even a sample implementation for GWT to get you started
ATM, I prefer the second option, since it goes best with the whole no refresh, same page, one app, GWT thing :) That is, unless I'm getting the wrong picture and you want to do something else.
GWT is really meant to be used for the whole application, where "pages" are replaced by application state and URL fragments, and "form submission" is replaced by AJAX calls.
If you want to validate form fields, this can easily be done with regular JS or a library like jQuery.
I'm not sure it I get you right either, but for what I'm receiving, having a new page to process the form is not the optimal design. The reason been that you might have to write different GWT app for that which mean overheads, and creating new window (or tab) will move the user's attention away from where they are. Why not using another page WITHIN gwt to process the form with tab panel or hidden panel?