[Wicket-user] Adding extra row to table in ListView
I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName())); item.add(new Label(firstName,rr.getFirstName())); item.add(new Label(startTime,timeDateFormat.format(rr.getStartTime(; item.add(new Label(endTime,timeDateFormat.format(rr.getEndTime(; } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Adding extra row to table in ListView
what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName())); item.add(new Label(firstName,rr.getFirstName())); item.add(new Label(startTime,timeDateFormat.format(rr.getStartTime(; item.add(new Label(endTime,timeDateFormat.format(rr.getEndTime(; } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Adding extra row to table in ListView
Igor, Yes, that makes sense. However, I get the data for the list using a single HQL query with joins and such. If I changed to a ListView within a ListView, then wouldn't I also need to change to do many HQL queries to build a bunch of small lists within a big list? I don't know what the performance implications would be of making this change. Also, last night I was working on switching it to a DataView instead of a ListView. Could a single DataProvider supply the data for both the outer and inner views? Thanks! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName())); item.add(new Label(firstName,rr.getFirstName())); item.add(new Label(startTime,timeDateFormat.format(rr.getStartTime(; item.add (new Label(endTime,timeDateFormat.format(rr.getEndTime(; } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Adding extra row to table in ListView
you can still have only one list. then have an imodel implementation that filters that list on the fly. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Yes, that makes sense. However, I get the data for the list using a single HQL query with joins and such. If I changed to a ListView within a ListView, then wouldn't I also need to change to do many HQL queries to build a bunch of small lists within a big list? I don't know what the performance implications would be of making this change. Also, last night I was working on switching it to a DataView instead of a ListView. Could a single DataProvider supply the data for both the outer and inner views? Thanks! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName())); item.add(new Label(firstName,rr.getFirstName ())); item.add(new Label(startTime,timeDateFormat.format(rr.getStartTime(; item.add (new Label(endTime,timeDateFormat.format(rr.getEndTime(; } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Adding extra row to table in ListView
Igor, Upon further thought, how can a ListView inside a ListView solve this? Wouldn't the hierarchy cause the html to be messed up? I can't have TRs within TRs. The inner listview isn't putting child data inside of the TR, it needs to make TRs that are siblings of the outer listview. The output should be like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td /tr tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /table Not like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /tr /table What am I not getting? Thanks, Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you can still have only one list. then have an imodel implementation that filters that list on the fly. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Yes, that makes sense. However, I get the data for the list using a single HQL query with joins and such. If I changed to a ListView within a ListView, then wouldn't I also need to change to do many HQL queries to build a bunch of small lists within a big list? I don't know what the performance implications would be of making this change. Also, last night I was working on switching it to a DataView instead of a ListView. Could a single DataProvider supply the data for both the outer and inner views? Thanks! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName())); item.add(new Label(firstName,rr.getFirstName())); item.add(new Label(startTime,timeDateFormat.format(rr.getStartTime(; item.add (new Label(endTime,timeDateFormat.format (rr.getEndTime(; } } - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user - This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Adding extra row to table in ListView
you dont have to attach the listview to the trs though in 1.2.6 you can attach it to span and do dataview.newitem(..) { return super.newitem (..).setrenderbodyonly(true); table span wicket:id=groupView --- Outer listview tr td wicket:id=groupTitle/td /tr span wicket:id=dataView --- Inner listview tr td wicket:id=data/td /tr /span /span /table in 1.3 we have a placeholder that makes this easier table wicket:container wicket:id=groupView --- Outer listview tr td wicket:id=groupTitle/td /tr wicket:container wicket:id=dataView --- Inner listview tr td wicket:id=data/td /tr /wicket:container /wicket:container /table advantage of wicket:container is that it will validate markup even at design time, and it is stripped when strip-wicket-tags option is enabled. rarely you do hit these cases where doing this in a jsp is easier because the jsp renders top-down, but in my experience they are few and far in between. and more importantly we have solutions to make them work. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Upon further thought, how can a ListView inside a ListView solve this? Wouldn't the hierarchy cause the html to be messed up? I can't have TRs within TRs. The inner listview isn't putting child data inside of the TR, it needs to make TRs that are siblings of the outer listview. The output should be like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td /tr tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /table Not like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /tr /table What am I not getting? Thanks, Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you can still have only one list. then have an imodel implementation that filters that list on the fly. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Yes, that makes sense. However, I get the data for the list using a single HQL query with joins and such. If I changed to a ListView within a ListView, then wouldn't I also need to change to do many HQL queries to build a bunch of small lists within a big list? I don't know what the performance implications would be of making this change. Also, last night I was working on switching it to a DataView instead of a ListView. Could a single DataProvider supply the data for both the outer and inner views? Thanks! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new SimpleDateFormat(h:mma); ReportRow rr = (ReportRow) item.getModelObject(); Date update = getStartDate(rr.getStartTime()); if (current == null || current.getTime() update.getTime()) { current = update; item.add(new Label(date,dateDateFormat.format(rr.getStartTime(; } else { item.add(new Label(lastName,rr.getLastName ())); item.add(new Label(firstName,rr.getFirstName())); item.add(new
Re: [Wicket-user] Adding extra row to table in ListView
Sweet! I do have it working with an extra tag (where you use the span), but I didn't like that it rendered invalid html. Didn't know about setrenderbodyonly. Thanks for the tip! When I move to 1.3, I'll use the container approach. Thanks Igor! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you dont have to attach the listview to the trs though in 1.2.6 you can attach it to span and do dataview.newitem(..) { return super.newitem(..).setrenderbodyonly(true); table span wicket:id=groupView --- Outer listview tr td wicket:id=groupTitle/td /tr span wicket:id=dataView --- Inner listview tr td wicket:id=data/td /tr /span /span /table in 1.3 we have a placeholder that makes this easier table wicket:container wicket:id=groupView --- Outer listview tr td wicket:id=groupTitle/td /tr wicket:container wicket:id=dataView --- Inner listview tr td wicket:id=data/td /tr /wicket:container /wicket:container /table advantage of wicket:container is that it will validate markup even at design time, and it is stripped when strip-wicket-tags option is enabled. rarely you do hit these cases where doing this in a jsp is easier because the jsp renders top-down, but in my experience they are few and far in between. and more importantly we have solutions to make them work. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Upon further thought, how can a ListView inside a ListView solve this? Wouldn't the hierarchy cause the html to be messed up? I can't have TRs within TRs. The inner listview isn't putting child data inside of the TR, it needs to make TRs that are siblings of the outer listview. The output should be like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td /tr tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /table Not like this: table tr wicket:id=groupView --- Outer listview td wicket:id=groupTitle/td tr wicket:id=dataView --- Inner listview td wicket:id=data/td /tr /tr /table What am I not getting? Thanks, Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: you can still have only one list. then have an imodel implementation that filters that list on the fly. -igor On 5/3/07, Tauren Mills [EMAIL PROTECTED] wrote: Igor, Yes, that makes sense. However, I get the data for the list using a single HQL query with joins and such. If I changed to a ListView within a ListView, then wouldn't I also need to change to do many HQL queries to build a bunch of small lists within a big list? I don't know what the performance implications would be of making this change. Also, last night I was working on switching it to a DataView instead of a ListView. Could a single DataProvider supply the data for both the outer and inner views? Thanks! Tauren On 5/3/07, Igor Vaynberg [EMAIL PROTECTED] wrote: what you need is a lsitview in a listview the first outputs the date row, and then a listview that outputs rows for that date. makes sense? -igor On 5/2/07, Tauren Mills [EMAIL PROTECTED] wrote: I'm using a custom ListView to generate a table. The content of the table consists of four columns of data. I have that working just fine. But I'd like to add an additional table row on occation to group rows of data in the table. Thus, there would be a groupRow that specifies a date, then many availRows of data for that date, then another groupRow, more availRows, and so forth. Here is some example HTML. I know that this HTML and code will not work the way it is now -- it is just meant to illustrate. The first TR should only be displayed when the date changes. Otherwise, only the second TR should display in each populateItem. table tr wicket:id=groupRow td colspan=4 wicket:id=date/td /tr tr wicket:id=availRow td wicket:id=lastName/td td wicket:id=firstName/td td wicket:id=startTime/td td wicket:id=endTime/td /tr /table Here is the custom ListView's populateItem: protected void populateItem(final ListItem item) { SimpleDateFormat dateDateFormat = new SimpleDateFormat(M/d/); SimpleDateFormat timeDateFormat = new