Need advice for dispalying multiple rows with datatable.
Hi All,
We have to design a conference booking search form which contains nX48 table.
n -> indicates the conference rooms and 48 are the time slots(30 mins gap).
While booking a conference room user enteres from time and to-time and from and to dates.
In our search form, user searches with in the range of dates and times.
We give a option for user to view according to date wise or room wise.
Now main prblm is that we are capturing from and to times but how do we represent in data table.
out of 48 columns assume only 4 slots are booked i.e 1200 hrs to 1400 hrs. so we need to display an image in that columns and up on clicking on that cell we have to produce data regarding that booking.
In our pojo we have to and from time variables , but how can we display in datatable..should have to take a 48 column pojo.., if so how can I get the data at intersection point?
Please do help me...
Regards,
Kranthi Kiran
# 1
You could certainily create a 48 or 96 column grid. I would assume a simple "bar" image would go into that grid. You can create a method that gets called to determine if the image is rendered or not. Use a stylesheet (inline style) to set the width of the grid.
While making a table with 48 column definitions is somewhat messy it is certainly no harder than cut and paste. The messy part is how to implement the boolean getter (DI) call to determine if a cell image is rendered as this would require 48 or 96 unique method definitions (one for each time slot). If you are will to do this then the solution is straight forward with a table.
As for clicking on the image cell that is not an issue and easily handled.
You have not mentioned what component suite you want to use. May I recommend that you take a look at Apache Trinidad (MyFaces project) or Oracle's ADF offering.
If not you could do this with two tag iterators (e.g. tr:iterator) but fussing with trying to make sure you get cell alignment might be hard to do since you would not have a "master" grid in which you would be rendering your data.
Could also write your own component ... but suspect you don't want to go there.
You will find that they provide a robust table implementation that also supports the concept of "details", sort of a drill down capability that you can add to see additional information associated with a summary line in a table.
# 2
Hi smurray_erie ,
Thakns for your response.
I am using Icefaces 1.5 and myfaces..
Should I go for datatable or panel grids and how far is it feasible.
Our search comprises of ANDs.
At the backend table looks like:-
Scheduler table consits of from time and to time and date booked.
for ex_
1200 hrs 1400 hrs july 12'07
1200 hrs 1400 hrs july 13'07
1200 hrs 1400 hrs july 14'07 and so on.....
And an another table contains of Conf. room names--
On the left hand i should display room names .. and
Top I should in the first row heading --Date.. and second row consists of 48 time slots.
The actual data should be present at the intersection of room and slots.
I have two variables for time slots and should I create 48 methods for slots?
How can I get the intersection point data--I require bcoz when ever user mouse hover on it I should display the corresponding data...and when user clicks on it he/ she shud be able to modify the room which has been booked.
Regards,
Kranthi
# 4
Maybe a combination of a datatable (one record per conference room) and a dataList (for each of the 48 timeslots) could be your ticket...
the dataList from Tomahawk (http://myfaces.apache.org/tomahawk/dataList.html) allows you to render any jsf-components you like in a loop. What you then will need is a get-method that returns an array of the timeslot-info (one value per timeslot). Thats some piece of logic you will need to write yourself...
h:dataTable value=myRecord var=record
h:column
conference room-header = record.heaerField
/h:column
t:dataList value=myRecord.timeSlots var=slot
h:column
timeslot=slot.state
/h:column
/t:dataList
h:dataTable
hth
Alexander