I have list of rows displayed on the screen. These rows are iterated using the JSF datatable component. Now my requirement is to edit any particular row which user clicked.
Is there any way to make the fields editable while user clicking the row. Then user will fill the details and save it.
Any suggestions would be appreciated.
Creating editable data tables is very easy with jsf. Here is a good tutorial on this. But "making it editable when user clicks on it" is not supported out of the box. And this is where JSF shines, you just need to find for a JSF component (open source or commercial) compatible with your JSF (1.x or 2.x) version and start using it.
My first suggestion for you is to check and see if PrimeFaces provides this kind of component. Here is the component you are looking for.
Related
In my project(working on Spring and hibernate) i need to keep around 22 HTML dropdown for a form, each dropdown have around 30,000+ entries every dropdown fetching data from database because of this page loading getting delayed (40+ sec) now i wanted to replace dropdown to similar function one, now i thought to keep autocomplete text box, now i wanted to know major performance issues in HTML Dropdown and autocomplete textbox or any suggestion or any alternative for this Thanks in advance.
I think use of autocomplete text box is more beneficial than dropdown.
In case of dropdown, data is loaded at once so it get delayed.
In this case only one request is made to database.
In case of autocomplete text box,data will load in exactly required text box.
So loading time for jsp reduces sharply.
(a) For autocomplete text box,there is no need of using any kind of plugin, as one can manage it easily.
(b) Use simple json format for providing input to text box using ajax.
(c) Define condition on text box for firing ajax request for showing text like..
want to get text after typing 3 characters etc...
You can also use jquery chosen plugin.
You can have normal select box with the jquery chosen plugin applied to that particular select box.
Refer http://davidwalsh.name/jquery-chosen
Suppouse I have a dataTable, with one of it's columns being a commandLink, which opens a rich:modalPanel with detailed info about the item. The question is, whether the #DataModelSelection field will still have the row on which I clicked on the commandLink when the modalPanel is open? Currently I try to show one of items' fields with simple outputText and it's not rendered.
Ok, reading the following article helped.
Is it possible to drag and drop some table from a web page and get the same table structure on a JTable?
You'll want to implement a DropTargetListener on the swing component you want to drag the HTML into. Then get the HTML from the drag using a text/html DataFlavor, and parse the HTML, converting it into a TableModel. Set this TableModel on your JTable.
I rode it is possible to Drag n Drop from desktop to browser, but not the other way around.
So, i don't know the answer to your question, but i would mention a little idea came to mind, maybe you find interesting:
Not directly dragging the table to the swing app. Instead drag that table from the browser, to some textArea or image on the page. It could then automatically transform the tabellar data to XML start some stream that sends that data to your swing application(Maybe some webservice could do pass it to the desktop app).
I don't know if that can help you giving you some tips, other thing comes to my mind is the dropbox API for java, check it out, maybe you have some interesting features that can help you.
I am using JSF 1.1 and I'm looking for a JSF list of values component.
I have a button and when I click that a popup window should open with one text field and buttons, where either I could search for what I am looking for in the text field or select all the values when I click on the buttons and from the available list of values I should be able to select one item.
Is any such type of component available in JSF 1.1 or with the icefaces, richfaces or apache jsf components?
Your question title is a little bit confusing, as you don't seem to ask for just a "list of values"-component, but a bunch of different components. Your situation is too specific to have a single existing component covering it all, but you can rather easily achieve the effect by combining a number of components.
Anyway, RichFaces has a modalPanel that you can use for the popup. Text fields and buttons are in the standard Faces library and the 'available list of values` can be handled by a selectOneMenu component, which is also in the standard library.
One additional hint, if it's in anyway possible try not to use JSF 1.1. This is an extremely old version where the list of problems is nearly endless. If you are somehow stuck on a very servlet container you should at least use JSF 1.2, but much better is to use the latest 2.1 release.
HI All,
I am desperately looking for the assistance on adding and removing the fields and rows using JSF. I am using ICE Faces for the rich UI look. The following is my problem:
I have to add one text box and two buttons (+) and (-) in a row.
When user clicks on the + button, one new row should be added with the above components.
When user clicks on the - button, the corresponding row should be removed from the display.
I am able to add the individual components like text box and remove it. But, here my challenging point is to add and remove as a row. How would I remove that specific row (instance) from the UI View Root.
I have tried several times, but till now I could not find a solution. Please suggest me the possible solutions.
Thanks in advance,
Krishna
Rather use a h:dataTable (or the IceFaces equivalent ice:dataTable) which is backed by a List<Data> contining objects which each represents the data of a single row. On Add just add a new Data item to the list. On Remove just remove the selected Data item from the list.
See also:
How to dynamically add new row to table? - detailed answer to similar question
Using Datatables - shows step by step how to use datatables in JSF 1.x.
CRUD datatable using #ViewScoped - simple example of JSF 2.0 CRUD