THX for the great help.

Especially the code snippets!

[EMAIL PROTECTED] schrieb:
Benedikt:

I have a plugin that creates a sortable table - the XHTML, not the wiki markup. Here is a snippet of what the plugin does:

                out.append( "<div class=\"sortable\">\n" );
                out.append( "<div class=\"table-filter\">\n" );
                out.append( "<div class=\"zebra-table\">\n" );
out.append( "<table class=\"wikitable\" border=\"1\">\n" );

                out.append( "<tr class=\"odd\">\n" );


for (Iterator iter = headers.iterator(); iter.hasNext(); ) {
                        out.append( "<th>");
                        out.append((String)iter.next());
                        out.append( "</th>");
                }

                out.append( "</tr>\n" );

                //snipped DB stuff
                while (rs.next()) {
                        //snipped business logic here
                        createRow(cells, isOdd);
                        isOdd=!isOdd;
                }


                out.append( "</table>\n" );
                out.append( "</div></div></div>\n" );



The createRow method called from the loop:
        protected void createRow(ArrayList cells, boolean isOdd)
        {
                if(isOdd)
                {
                        out.append( "<tr class=\"odd\">\n" );
                }
                else
                {
                        out.append( "<tr class=\"even\">\n" );
}


                for (Iterator iter = cells.iterator(); iter.hasNext(); ) {
                        out.append( "<td>");
                        out.append((String)iter.next());
                        out.append( "</td>");
                }

                out.append( "</tr>\n" );
        }


It's nothing fancy, but it looks great and gets the job done. Hope it helps.

-Lou







Benedikt Mohrmann <[EMAIL PROTECTED]> 09/19/2008 03:34 AM
Please respond to
[email protected]


To
[email protected]
cc

Subject
Re: Dynamically inserting forms






Hi,

I didn't get it unitl now.
My goal is to dynamically add wikimarkup into the page.
To be more precise, I am trying to add a sortable table (via the %%sortable Tag) into my document, which contains the content that my Plugin returned.

Thus I tried things (in my plugin) like:
return "%%sortable myContent  /%"
and
return "%%sortable \n myContent \n  /%"
and
return "%%sortable <br> myContent <br> /%"

but none of this alternatives solved my problem, because there is never a table inserted into the document, but only the String!


Regards
Benedikt


Janne Jalkanen schrieb:
My Plugin returns a String, which contains e.g. "[{FormTextarea name='output' rows=10 cols=80}]". But it does not create a TextArea, but instead just prints the String on the Main Page!
Hi!

Plugins should always insert XHTML. If you want to return wikimarkup, you'll have to first run it through RenderingManager.

/Janne




Reply via email to