jsf - Display DataTable with unknown numbers of column -
i need in solving problem having project. anyway, new jsf. working on project , there module examination records displayed students database upon successful authentication. easy if students in same class , offer same number of courses, can create datatable model , use in view. in case, database contains tables student’s exam records in different departments , classes computer science 100,200 , 300 levels, geology 100,200 , 300 levels , on. these students offer entirely different courses. offer physics, gst, computer , don’t.
my problem how display different students grades , course names in datatable dynamically. let me try , picture it.
100 level computer science table has cs101 cs102 gst101 math101 math102 phy101 chm101
200 level computer science table has cs201 cs202 cs203 math201 chm202 please note difference in number of columns , names of column headers.
then computer science 100 level student wants view or exam records, how display these records column names in datatable dynamically , not first creating datatable model predefined column names. not knowing number of columns or names in advance. how do different students in different classes? want code enable students department or level login , retrieve exam records. not asking authentication code has been achieved, code display names of database table column headers , records hold particular 100 or 200 level. need because don’t have create datatable model containing specific column headers have many tables in database different numbers of columns , names different students departments , classes. please need , hope i’ve been able communicate problem clearly. using jsf 2.1 (facelets , manage bean), mysql database server on netbeans 7.2.1.
i in similar situation , afraid there's not possible way fill datatable unknown columns. have have numbre in advance. in case, found easier shift jsp particular need , keep jsf more "static" usage. in understanding, dynamic aspect of datatable numbre of rows.
one way turn around problem using rendered attribute of columns, in case you'll put in every possible column , decide (via bean, example) show or not of them , hide others. semi-dynamic @ best, still livable solution.
best of luck.
p.s : if wrong, please inform me of solution because curious know though unable use it.
Comments
Post a Comment