When you go to this page http://tuckertrans.com/ComputerInventory.aspx my navbar displays vertical until the grid loads. My grid also takes 2-3 seconds to load. Im just grabbing the list from the database, assigning that list to the grid's datasource, and finally binding the data. Whats taking so long for the page to load? This causes my navbar orientation to be wrong until it loads. Any way to speed this up?
Dim li As List(Of ComputerInfo) = Process.Get_Computers()
Me.gvComputers.DataSource = li
Me.gvComputers.EditIndex = -1
Me.gvComputers.DataBind()
my navbar displays vertical until the grid loads
Client browser receives CSS files later than ComputerInventory.aspx. It is normal in web page.
However, in your case, your web page has too many data. As the result, it makes every thing slow.
Ideally, you want to use Pagination with Ajax. In addition, you only want to retrieve data that you want to display. For example, retrieving 10 rows from database using skip and take.
Related
I have a very simple scenario. A web page with a list of items which invokes ajax call upon clicking on any item and dynamically add some text to the page.
Now, obviously, if I leave this page and then I press the back button I get the initial list without all the dynamically added text.
I've been reading a lot about this issue. There are a many tricks to preserve the information and/or load it again from server. But it seems to me that this really simple and desired behaviour should have a simple solution without the need for any trick or server re-loading which will result in obvious noticeable delay for the user.
So, does anyone know about a simple way to get back to the page via back button and retain all the dynamically added parts without the need to load them again from the server?
I have a javascript which fetches thousands of records from some http server. These records are then displayed in HTML by adding div. Now, instead of fetching and adding all the records on initial pageload, I want to load them as and when user scrolls down. So, initially as many records are fetched and displayed as there is space on the window. And, when user scrolls down, more divs are added and previous divs are removed (or reused) and so on. How can I do this? Any suggestions are welcome.
Well first you need a plugin/script to do infinite scroll
then build a query for your http server which only return the requested number of records and call it with ajax. What Else?
I have two different HTML files, two different UIWebViews & a UISegmentControl. On segmentChanged, I had displayed the WebView by loading a HTML file.
Both HTML files contains common sections only the section content is changed. Now I want to implement the functionality that, when user reads section 1.1 of first WebView & clicks Segment for loading second WebView, then the second WebView needs to scroll upto the section 1.1 which he reads in first WebView and viceversa. Also there are n number of sections.
I used following javacript but it needs the parameter of current div id. But on scroll, how can I get the current visible div id. I had given the id for each div.
function pointInView(id)
{
var divid = document.getElementById(id);
divid.scrollIntoView(true);
return false;
}
Anyone please help me.
I think jquery might be able to come to your rescue.
Could you use jQuery, since it's cross-browser compatible?
http://stackoverflow.com/questions/5353934/check-if-element-is-visible-on-screen
Check out answer form BenM
You don't really need a db entry for that. Just catch the click event via something like
$('.action').click(function(){
document.location = yourSecondFIleLocation+'?offset = ' + $('selectorDiv').detOffsetFromParentDiv(); //or get the scroll offset from the page.
});
and catch it on the second page either with php or jQuery to scroll to it.
Heck that is even achievable if you put in your code the paragraph marks and link correctly to them.
I searched a lot to get the div id from current scroll offsetbut didn't get the solution for it. So I go with the other option that, stored the start & end offsets of each section in both files. So I had created one look-up table in database & stored the start & end offsets of each section in both files.
ex. When user scrolls the first webview to section 1.1 & clicks the switch to open the second webview, then I scrolled the second webview to the section 1.1 in the second file.
Please try below,
To scroll any scroll view at any position we set the content offset of the scroll view.
To solve your problem we have two solutions,
In your case when user is viewing the first Web view, save the content offset of the first web view in any variable like below
CGFloat offset = webView1.scrollView.contentOffset.y; Then when you
open the second web view then provide this offset value to second
web view scroll offset.
Set
webView1.scrollView.contentOffset=webView2.scrollView.contentOffset
or vice versa according to your need
I hope this will help you.
I have a 3 column structure for my site.
Links are shown at Left hand side layout.
User clicks a link, and I trigger an AJAX call to load middle column of layout. I load a complete template file in the middle column.
My question -
When user clicks another link, I make another AJAX call to load middle column.
After each sub sequent ajax call, does my DOM gets heavier in size, as I am loading different htmls in middle column, without refreshing whole page ?
No. If you are replacing the data with new data then the old data is discarded.
Well, yes your DOM as you say is technically bigger and you are dynamically injecting HTML. However, this should not be an issue, and certainly not on the client. Size is only of concern if you are downloading the whole page.
I am currently working on a GWT application that requires report
printing. The use can select report parameters from a screen, and
upon clicking print we would like to display the file as it is being
generated. Currently we have server side code that is generating HTML
and writing it to a file. When the user clicks print, an RPC is being
made to pass the report parameters to the server and begin the
report. A second RPC is made after the report has started to obtain
the report's URL. From here, we are creating a Frame and setting the
URL to be the URL retrieved by the second RPC.
The issue I am running into, is that when setUrl gets
called, it only displays as much HTML that was contained in the file
at the time of the call. What would be the best way to refresh just
the frame containing the HTML report? It appears making subsequent
calls to setUrl passing in the same Url each time would do the trick,
but it actually doesn't seem to contain the additional content that
would've been written since the last call. It is also resetting the
vertical scroll bar's position each time back to the top of the bar
which is something else I would like to prevent.
Is there a better way to go about doing this?
I think it would be better to request HTML in chunks from GWT and render them as they arrive. Doing this with ajax instead of wholesale refreshes will enable better behavior with the scrollbar, eliminate flashing, get around caching problems, and will also let you add some feedback like a progress bar, estimated time remaining, etc.
There's a lot more infrastructure required for this, but your suggested solution doesn't seem quite appropriate for the task.