RichFaces application, should I use rich:dataTable or jQGrid, pros cons?

て烟熏妆下的殇ゞ 提交于 2020-01-14 19:15:47

问题


Following on from here, I need to have an inline editable grid in my web application using RichFaces 3.3.3, JSF 1.2 and Facelets.

My options are the rich:dataTable RichFaces control, or the jQuery plugin, jQGrid

I have tried both and found the following so far:

  1. jQGrid works really well, but I am not sure what will happen if I try to refresh JSF controls from the grid, if that's possible?
  2. I am hesitant to use or trigger RichFaces modal windows from the jQGrid, can this cause problems? Or should I stick to plain jQuery modals?
  3. to be safe using the jQGrid it looks like I have to do a lot of my own plumbing, losing the benefits of richfaces controls? Am I right?
  4. rich:dataTable does not have a scrollable table with the headers fixed. richfaces has a scrollable table, but making that support inline editing has issues. (Headers dissapear, and editing does not work properly)
  5. rich:dataTable is not very customizable and is missing some very nice to have features that jqGrid has
  6. rich:dataTable has some issues that seem unresolvable or will need js hacking (eg. making a row editable on single click instead of the default double click causes issues if you use a calendar control inside the editable row, one click inside the calendar control fires an edit event again on the row making you lose your changes in other fields).

In addition to some of the questions above, I would like to know what are the pros, cons of each, and what approach would be easier to maintain and extend and complete in the long run.


回答1:


I have worked with ricfaces and JSF for 4-5 years before moving to jQuery components and Grails for last 1.5 years. And here is my take on the subject:

  1. Ultimately JSF controls are rendered as HTML components and so I do not see any issue refreshing the components (if at all you do not have a handle on the ids generated for jsf controls you could surround the controls with div and then refresh the div).
  2. IMHO - jQuery modals are pretty simple to use and more flexible than RichFaces modal panel.
  3. I do not think this is correct but without knowing your use case it would be difficult to tell. I believe the one thing you will lose is two way data binding provided by jsf components.

4,5,6 - favors jqGrid.

Pros of using JSF - Since your server side code is JSF, you get the data binding built into your UI components (both ways - server to client and client to server). The other thing is the look n feel of JSF components will match with rest of page. With jqGrid you will have to customize the theme.

Cons of using JSF - rich:dataTable is not very customizable and not that rich compared to jqGrid. So if you have a complex UI and you realize that a particular UI feature is not supported via rich:dataTable, you have no option but to use some other component or let go off that feature.

Pros of jqGrid - Rich in features and very easily customizable. I have done - treegrid, frozen columns, editable columns, client validation with qtip plugin etc.

Cons of jqGrid - Only one way data binding from server to client. And in order to accomplish this, you will have to write some server code to format the data into a JSON structure before sending it to client. For data binding from client to server: you will have to manually map the request params into a JSF bean.

Note: I have not used jqGrid with JSF backend. However, my response is based on my understanding of how each of the framework works.



来源:https://stackoverflow.com/questions/3902687/richfaces-application-should-i-use-richdatatable-or-jqgrid-pros-cons

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!