Is there some easy way or maybe a ready component to use lazy-loading in dataTable by Primefaces but without pagination (also not the standard one) ?
I need following feature: when page is loaded dataTable contains only first 10 out of 100 rows (fast response time).
The rest of rows is automatically loaded into the dataTable but user can already work with first portion of data.
Thanks for any advice. In worst case I will have to implement similar behavior by myself, but maybe someone already have some experience.
The feature you're looking for comes very close with "live scrolling". It does load in the background, but only when the bottom is reached in scrolling. See the "DataTable - Scrolling" showcase page.
Here's an extract of relevance from the showcase example, showing the attributes you need:
<p:dataTable var="car" value="#{tableBean.carsLarge}" scrollRows="20"
scrollable="true" liveScroll="true" scrollHeight="150" id="dataTable4">
However, to achieve exactly your functional reqirement, you'd probably need to homebrew or post a new feature request to PrimeFaces guys.
Related
Basically ui:repeat produces a long list of divs. I would like to use something similar to jquery append() and ajax so that the entire list is not rerendered.
Basically like this:
Customer demand: CTRL + F must work so I cant lazy very well.
Render huge list as divs with panelGroup. Pay close attention to generated html because of the huge amount of data...
Get websocket call something changed and you need a new element after hugelistForm:div982. Basically jquery append would be great but not sure how to integrate it.
This will cause the List backing the ui:repeat and the view to become disconnected. However the list is updated in the "background" so F5 would make things normal...
I use latest versions of JSF, Primefaces, Omnifaces.
I have around 10 tables in my database. Building CRUD’s for these are easy with ie. reverse engineering in Netbeans, and with Netbeans 8 the pages look great thanks to primefaces.
So now I have 4 pages per entity; list, create, edit and view. Create and edit are similar except they bind to a new respective an existing entity. View is similar to edit, except it is readonly. The available buttons change too, of course, and there are probably other minor differences.
What I would like is to keep it down to 2 components per entity; 1 for the list and 1 for an instance. The latter should come in 3 flavours; editmode, createmode and viewmode. These components should be includeable in other pages, preferably both as dialogs and “raw” imports.
Anyone have an idea whether this is possible? Do I need to create my own set of renders, which can ie. render an inputText-component and a selectOneMenu as an outputText? As an example my first try with an inputText was just to write disabled=”true”, which renders the inputtext as non-editable. It becomes too greyish, but I guess that would be fixable by overriding the style. But preferrably it should render as a real outputText would when in viewmode. Maybe some clever use of css could do the job instead of renders.
Maybe the easiest way would be to store the viewmode of the composite component in the componenttree. Is this possible? I guess any component would have to look up in the tree in the render phase, to see how it should render.
For the buttons I could maybe do with just the rendered attribute.
Is it possible to go this route, or has anyone already made a framework for this? Or is it stretching JSF too far?
I am creating web application for booking tickets. After querying from DB for given inputs now i have 230 records (ticket informations) which has been added to list ,as objects (pojo's) .in JSF i am using "ui:repeat" to iterate the list. Here got confused how to create pagination on this. (i want to display 40 records /page). I should not hit the backend for each and every "NEXT" or "PREVIOUS" click .. Any help would be thankful.
Note: when i hit search button my flow will navigate to result.jsf page where i passed the 230 records for display.
Technology: Spring web flow and JSF 2
simplest solution is to use PrimeFaces DataTable Pagination or equivalent without reinventing the wheel
I have an ASP.NET MVC page which contains a table, where every row takes some time to load. So I'm calling Response.Flush() after every row is rendered.
IE9 behaves the way it should: displays rows one by one. FF4 on the other hand, displays the page only when it finished loading completely, even though I can see in FireBug's Network tab that the rows are being received one by one.
Is there something I could be doing wrong on the server-side? If not, is there something I can do to my Firefox, so that it displays the page the way I want?
I would try using AJAX to fill the table. Maybe a row per call, maybe whole set at once.
Consider closing your document with </html> and add the extra rows in script; <script> tags may (in practice) follow </html>. Not a real AJAX solution, not strictly correct, but potentially a lot easier on your serverside.
A similar, but more correct solution would be to insert the script just before the </body>.
See also When does reflow happen in a DOM environment?
thanks in advance for any input. I am using struts2 and jquery in this app.
I tried to use displaytag for pagination but my tables have images and there wasn't a way I could make displaytag work with images.
So now I have custom coded pagination which uses <s:subset> which works great so far except that I don't know how to make it go to another page.
Basically in <s:subset> I just want to change the start attribute and then refresh my JSP. My code evaluates the start attribute correctly with a given page number.
My s:subset tag is like below,
<s:subset source="pageableList.pagedList" count="pageableList.pageSize" start="pageableList.start" >
<s:iterator>
I think I want to use <s:url> to display my clickable page numbers but I'm having trouble there.
I have my page numbers in a list (which I evaluate in my action class right after my search completes), then in my JSP where I need to display the clickable page numbers, I iterate through the list, displaying the page numbers like below -
<s:iterator value="pageNumList" > | <a href='#'> <s:property/> </a> </s:iterator>
I guess I need to pass the clicked value of page number to the action class, then since the search results are in a list in the action class, without hitting the database again just display the results page with the new value of start attribute.
Any ideas how I might do that? I have been considering using a Decider attribute with <s:subset> but maybe there is a simpler way?
Thanks again for any input.
Regards,
veeCan
If you do not want to hit your DB again, cache the results of the initial query in RAM in your Action class (reference a static cache somewhere). Also, you don't have to go with a cache-all-or-nothing approach -- you can cache the first N pages and then when you near the end of the cache, fetch the rest. If you do it right, you can maintain minimum RAM footprint but preserve a snappy user experience that leverages user think time (depends on your app).