Re: [Xsltforms-support] problem with xf:repeat within tables
Brought to you by:
alain-couthures
|
From: Dan M. <dan...@gm...> - 2011-12-29 13:54:05
|
Hi Joe, >From what I know, repeats within tables are very tricky due to the way that tables are rendered within a browser. Browsers usually assume that they get an entire table from the server and they then try to calculate the correct layout after the </table> tag arrives. With XSLTForms we build the table interactively after all the data arrives in the model and this confuses most browsers. Since some browsers have different strategies for rendering tables so it is very hard to get table rendering right across all browsers. I have found the most fail-safe way to render tabular data using the <repeat> is to try to use a combination of divs, spans and a CSS file that will create fixed-with output for the cells. This can be done with Blueprint using "span" tags within your class attributes. I know that this is not nearly as easy as using the <table> tag but it is consistent across most browsers. I suspect that you may be able to try to use a combination of tables and fixed-with cell layout and get it to work on FF9 on the Mac but it may not work on all tables. Here is a very small example: http://en.wikibooks.org/wiki/XForms/Highlight_Selected_Row This example uses a combination of the following: display: inline; position: absolute; margin-left: 150px; One newer CSS structure that I have also been using is the inline-block property. This allows you to set the "width" on any cell. Something that does not work with inline layout. The problem with this is that older versions of IE did not support it but since you are on FF this may work out fine. Let me know what works and I can update the XForms wikibook. - Dan On Wed, Dec 28, 2011 at 11:30 PM, Joe Wicentowski <jo...@gm...> wrote: > Hi all, > > I'm building a basic gradebook app for a professor I happen to know (my > wife) using XSLTForms, and while it's been working great for most of my > forms, I'm encountering difficulties when using <xf:repeat> inside of > tables. I would appreciate any suggestions or troubleshooting hints folks > here might have. I'm using XSLTForms (trunk rev. 522 from > http://xsltforms.svn.sourceforge.net/viewvc/xsltforms/trunk/build/) with > FF9 on Mac OS X. Here's the relevant portion of my form: > > <div xmlns="http://www.w3.org/1999/xhtml"> > <table> > <thead> > <tr> > <th>Student</th> > *<!-- one heading for the name of each assessment > (i.e., tests and assignments) -->* > <xf:repeat > nodeset="instance('course')/assessments/assessment"> > <th><xf:output ref="name"/></th> > </xf:repeat> > <th>Final Letter Grade</th> > </tr> > </thead> > <tbody> > *<!-- one row for each student record: name, grades for > each assessment, final grade -->* > <xf:repeat nodeset="instance('students')/student" > id="repeat-students"> > <tr> > <td><xf:output value="concat(surname, ', ', > forename)"/></td> > <xf:repeat > nodeset="instance('course')/assessments/assessment" id="repeat-assessments"> > <td><xf:input > ref="instance('students')/student[index('repeat-students')]/course-record/assessments/assessment[index('repeat-assessments')]/grade"/></td> > </xf:repeat> > <td><xf:input ref="course-record/final-grade"/></td> > </tr> > </xf:repeat> > </tbody> > </table> > </div> > > Here the "courses" instance contains info about each course, including > assessments (i.e., tests and assignments), and the "students" instance > contains info about each student's grades -- for each assessment and for > the final grade. > > The result in FF9 is quite odd. Instead of a structure I would expect > like: > > Student Test 1 Test 2 Final Letter Grade > ----------- --------- ---------- --------------------------- > Joe 80 81 B- > Sue 90 91 A- > ... > > I get something like: > > Test 1 Test 2 Final Letter Grade > --------- --------- -------------------------- > Joe > A- Sue Bill Harry Melinda ... > > Such an odd rendering suggests to me that either (1) there is a problem > with my coding of the form (2) there is an XSLTForms issue or (3) both. > I'm not sure which it is. When I search the list archives I see some > references to problems XSLTForms has with tables and repeats, and Alain's > suggestion to use the trunk version of XSLTForms and to use thead/tbody. > I'm using trunk and using thead/tbody, so we can rule those factors out. > I've also tried using the alternate "attributes" syntax for repeats > (detailed at http://www.w3.org/TR/xforms/#ui.repeat.via.attrs), and the > rendering of the form is even more unrecognizable. So I'm not sure how > best to continue troubleshooting the issue. Could anyone suggest some > ideas? I'm happy to provide more info. > > Thanks, > Joe > > ------------------------------------------------------------------------------ > Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex > infrastructure or vast IT resources to deliver seamless, secure access to > virtual desktops. With this all-in-one solution, easily deploy virtual > desktops for less than the cost of PCs and save 60% on VDI infrastructure > costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox > _______________________________________________ > Xsltforms-support mailing list > Xsl...@li... > https://lists.sourceforge.net/lists/listinfo/xsltforms-support > > -- Dan McCreary Semantic Solutions Architect office: (952) 931-9198 cell: (612) 986-1552 |