Pagination in html5 javascript SDK - usergrid

For the pagination I went through the documentation and understood that it is based on a cursor where you have to specify it to navigate back and forth. I have a requirement to navigate to first page and last page. Like you normally see in conventional Jquery or related grids with 4 buttons. Is this achievable? Also I would like to show the current page of the cursor like "Page 2 of 10". Is there anyway I can get this record count in the same response when you query?

Unfortunately, there really isn't a way to get to the last page. What you are describing is generally referred to as "limit,offset paging", which is common in MySQL or Postgres.
Usergrid currently only supports cursors. Due to the nature of the way cursors work, you have to navigate through the results in a linear fashion, starting at the beginning.

Related

How to make search query on certain web site and display it as native app

I have a task to implement but after some thought I don't really know from where to begin.
What I need to achieve:
Lets take as example BestBay web site. From my app I would like to create a certain query which will go/use to BestBay search type what I need and bring me the result. On my device I would like to show it as 10 views of the first items the website returned. For instance if I type "tvs" I will get a list of tvs so I would like to show this list on my device with the price and the link to the item (at least for the 10 first items).
I have experience with native apps(i didn't worked with web apps).
I can't use Best buy api.
I am not sure from where to begin.
I read about YQL.
I thought maybe to use the web page with the results as html and parse it to the objects I need.
Did anyone do something similar and can give me some starting point.
How to approach this kind of problem.
(tutorials/documentations/sample code something that can help me to start).
Tnx a lot.
In the end I decided to do it by HTML parsing:
parsing HTML on the iPhone
How to Parse HTML on iOS

Dynamic paged content - how can I make sure links lead back to the same content?

Say I have a series of posts which are paged starting with the newest posts on the first page, and ending with the oldest posts.
I'm trying to implement the paging in such a way as to allow for the following two things:
i) When someone copies the url and sends it to someone else, they will get the same results, even if it is 6 months later and there have been hundreds of posts added in the interim.
ii) When search engines index the content, links from search results will bring back the content that was indexed, even if the content that was on page 3 when it was indexed is now on page 7.
So to try and explain clearly. If I were to implement paging in the simplest way, I might have URL's looking something like this:
www.foobar.com/foo?page=7
but if someone takes that link and sends it to someone, page 7 could well have completely different content by the time the person comes to look at it. Likewise, the content that was indexed by a search engine would quickly become out of date.
I thought of having an id identify the first post in that particular page in the URL, instead of the page number. But then I run into issues of how to do the paging when someone comes in from that link, it becomes a bit problematic.
Or perhaps I should just forget these issues, provide permalinks to the posts themselves, and if users send the url to people instead of the permalinks then that's their lookout. I would prefer to cover these two scenarios though, if there is a neat way to do it.
Any help much appreciated.
We've looked at the way other people deal with this, and that is to allow people to navigate through posts by month and year rather than by page.
So instead of the navigation having page 1, page 2 etc...
We will have June 2013, May 2013
and the URL will look something like:
www.foobar.com/foo/2013/6
This is what wordpress/blogger seem to do.

Displaying Google results in a frame

Some time in the last year, a tool that I use no longer displays Google search results in one of its frames. I suspect that Google started using JavaScript code to hide itself, if it is being displayed in a frame, which is understandable for most uses.
However, this is a tool that only I use, so I'm not misrepresenting to anyone. I use this tool to research data. One frame has a form where I enter data that I find online. The other frame has the Google results and the pages they link to. I can see both the data form that I'm working on and the changing search/results side-by-side in one window.
I tried going to an older browser version, but I think they are using JavaScript.
Now I have to right-mouse click "open in a new tab" and then click to the new tab, and then close it, a lot of extra overhead when I'm trying to process this repetitive research over and over.
Any ideas? Confirmations as to what has changed? I suppose I could retrieve the page in PHP, strip out the part that hides the page and then put the page source in the other frame. A bit of a challenge for me.

MVC jqgrid Page Navigation When Data is Sorted

I am running a code with ASP .NET MVC jqgrid that populates the grid with data from the database.
The code is taken from :
http://jetmathew.wordpress.com/2011/03/02/asp-net-mvc-2-with-entity-framework-json-jquery-and-jqgrid/
The problem is that when I go to second page and sort the data with any column. It sorts the whole data but takes me to 1st page.
I want to remain on second page with whole sorted data. Is this a bug? And is there anyway around to get things go my way?
The sane thing is happening on all examples on this link as well.
http://www.trirand.com/blog/jqgrid/jqgrid.html
It's not a bug. Think about it, what meaning does the pagenumber have when the sortcolumn changes? IMHO none since you are looking at a different dataset...
What are you trying to achieve here?
edit
Craig Stuntz added Jquery BBQ integration to Jqgrid. This enables url history to jqgrid.
Using this you can take the current page from the querystring.
http://craigstuntz.github.com/jqGrid/
I still stand by my original answer though :)
/Daddy

Umbraco - postbacks caching problemm

I'm having a problem with a page I'm developing in umbraco. I'm fairly new to it so would really appreciate some guidance.
the problem seems to be connected to the way umbraco caches pages.
what i have is a stockist locator map (a map of Australia in my case).
from this page, the user can select a region to see stockists within that area.
i have a big fat search button along with some checkboxes for the user to choose what region they want to search in.
when i check say 'Sydney' and hit my search button, all is well. it returns the results i would expect.
but... if i go and click the search button straight away (again) - then the search results disappear.
its almost like umbraco is doing some weird caching thing. I've tried fiddling with the caching settings within the developer area (i.e. 'Cache Period'), but haven't spotted any consistent patterns which shed light on the problem.
oh, another thing - its not executing the page load and pageInit events (when retrieving from the cache).
So when you submit you control without selecting anything, you get empty result. Can this be, that is the logic of a control itself? As I see, it just gives empty result for empty search query.
Can you provide some sample code to demonstrate your implementation?
I've done plenty of Umbraco sites and have rarely found that Umbraco interrupts the normal ASP .Net page lifecycle so I'd be more inclined to guess you have a fault in your code.
Have you tried disabling your custom caching completely to ensure that the issue does not relate to your code?
Does your cache have a param dependency that is being cleared or anything?

Resources