简体   繁体   English

GXT 如何在 XTemplate 中显示树对象?

[英]GXT how to display a tree-object in a XTemplate?

I have the following problem: I am displaying Data of my GXT-project in a rever complex XTemplate.我有以下问题:我在一个复杂的 XTemplate 中显示我的 GXT 项目的数据。

@XTemplate(source = "DepictionDisplay.html")
    SafeHtml displayoben(String shortName, String inventoryNumber, String cave, String wall, String expedition, String vendor, String purchaseDate, String currentLocation, String stateOfPreservation, SafeUri imageUri, SafeUri fullImageUri,
            SafeUri realCaveSketchUri, double width, double height, String style, String modeOfRepresentation, String description, String generalRemarks, String otherSuggestedIdentifications); 

The relevant part of DepictionDisplay.html is: DepictionDisplay.html的相关部分是:

            <table class="data-view">
                <tpl if="inventoryNumber != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Inventory No.</i></td>
                        <td class="data-view-right">{inventoryNumber}</td>
                </tr>
                </tpl>
                <tpl if="cave != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Located in Cave</i></td>
                        <td class="data-view-right">{cave}</td>

                </tr>
                </tpl>
                <tpl if="wall != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Position in cave</i></td>
                        <td class="data-view-right">{wall}</td>
                </tr>
                </tpl>
                <tpl if="expedition != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Acquired by expedition</i></td>
                        <td class="data-view-right">{expedition}</td>
                </tr>
                </tpl>
                <tpl if="vendor != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Vendor</i></td>
                        <td class="data-view-right">{vendor}</td>
                </tr>
                </tpl>
                <tpl if="purchaseDate != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Purchase Date</i></td>
                        <td class="data-view-right">{purchaseDate}</td>
                </tr>
                </tpl>
                <tpl if="currentLocation != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Current location</i></td>
                        <td class="data-view-right">{currentLocation}</td>
                </tr>
                </tpl>
                <tpl if="stateOfPreservation != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>State of preservation</i></td>
                        <td class="data-view-right">{stateOfPreservation}</td>
                </tr>
                </tpl>
                <tpl if="style != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Style</i></td>
                        <td class="data-view-right">{style}</td>
                </tr>
                </tpl>
                <tpl if="modeOfRepresentation != &quot;&quot;">
                <tr style="border-bottom: 1px solid black">
                        <td class="data-view-left"><i>Mode of representation</i></td>
                        <td class="data-view-right">{modeOfRepresentation}</td>
                </tr>
                </tpl>
        </table>

The Problem is, that lately, I had to change the former String Value of wall to a tree-object.问题是,最近,我不得不将wall的前字符串值更改为树对象。 The entries of the tree object have a getchildren() function to navigate down and a getText() function to access the String value, which is to be displayed.树 object 的条目有一个 getchildren() function 向下导航和一个 getText() function 来访问要显示的字符串值。

My question is now: How can I display a Tree-Object inside this Table?我现在的问题是:如何在此表中显示树对象? So far, I did not find a suitable option as the tree can have a changing depth.到目前为止,我还没有找到合适的选项,因为树的深度可以变化。

Any Ideas are more then appreciated.任何想法都会受到赞赏。

Sincerely,真挚地,

Erik埃里克

XTemplates can take SafeHtml params, and insert that content, and have support for calling simple formatting functions, but cannot call themselves or other functions recursively. XTemplates 可以采用SafeHtml参数,并插入该内容,并支持调用简单的格式化函数,但不能递归调用自身或其他函数。

Consider iterating through that getChildren() and appending each of their rendered template to a SafeHtmlBuilder , then pass the resulting SafeHtml string to the parent.考虑遍历该getChildren()并将其呈现的每个模板附加到SafeHtmlBuilder ,然后将生成的 SafeHtml 字符串传递给父级。 Your own code then does the recursion, inserting smaller bits of content into bigger ones.然后您自己的代码进行递归,将较小的内容插入较大的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM