Javascript 如何将单个实体显示为弹出窗口

Javascript 如何将单个实体显示为弹出窗口,javascript,odata,sapui5,Javascript,Odata,Sapui5,我目前正在学习如何在没有模板的情况下手动开发UI5。我目前正在通过oData请求向系统获取模型,并将返回的实体集显示为带有ColumnListItems的表 用于表视图的XML: <Table noDataText="Es stehen keine Aufträge in der Queue" id="table0" items="{ImpMan>/QueryEntrySet}" growingDirection="Downwards"

我目前正在学习如何在没有模板的情况下手动开发UI5。我目前正在通过oData请求向系统获取模型,并将返回的实体集显示为带有ColumnListItems的表

用于表视图的XML:

    <Table noDataText="Es stehen keine Aufträge in der Queue" id="table0" 
        items="{ImpMan>/QueryEntrySet}" 
        growingDirection="Downwards" 
        modeAnimationOn="false" 
        mode="SingleSelectMaster" 
        selectionChange="onSelectionChange">

       <!-- Here is column logic and ColumnListItem tags etc. -->
    </Table>
我能够获得整个单击的实体和显示我的
/EntitySet('ID')
上下文.sPath
。所以我确切地知道点击了哪个实体。现在,我想向该实体显示所有详细信息,因此必须将其传递到弹出窗口。我已经用objectlistitem创建了一个片段:

<core:FragmentDefinition xmlns:core="sap.ui.core">
<Dialog xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns:html="http://www.w3.org/1999/xhtml" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns:action="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" xmlns="sap.m" id="transportDialog" title="Auftrag">
    <ObjectListItem type="Active" number="{path:'ImpMan>PIMPDATE',formatter:'.formatter.getDate'}" numberUnit="Geplanter Import" intro="Gruppe: {ImpMan>GROUP_ID}" id="item0" title="{ImpMan>TRKORR}" icon="sap-icon://product" highlight="{path:'ImpMan>CRIT',formatter:'.formatter.critState'}">
        <attributes>
            <ObjectAttribute text="{ImpMan>ID}" id="id_att"/>
            <ObjectAttribute text="{ImpMan>ID_TEXT}" id="description" title="Beschreibung"/>
            <ObjectAttribute text="{ImpMan>LAST_EDIT}" id="last_change" title="Letzte Änderung"/>
            <ObjectAttribute text="{ImpMan>CHANGEDBY}" id="editor" title="Verantwortlicher"/>
        </attributes>
    </ObjectListItem>
</Dialog>

我还知道如何将片段定义为对话框并打开它。但我无法将从单击的表中提取的实体绑定到新对话框并显示其值


有人能帮我吗?这应该如何工作?

首先,不建议直接访问内部变量,因此必须进行更改

 var entity = context.oModel.getProperty(context.sPath);

现在,关于您的问题,当您打开一个对话框时,您将有一个变量与您的对话框,您可以像这样绑定元素:

... 
var oDialog = sap.ui.xmlfragment(
                        "<fragment_path>", this);
...
oDialog.bindElement(context.oModel.getProperty(context.getPath()));
oDialog.open();
...
。。。
var-oDialog=sap.ui.xmlfragment(
”“这个);
...
bindElement(context.oModel.getProperty(context.getPath());
oDialog.open();
...
 var entity = context.getModel().getProperty(context.getPath());
... 
var oDialog = sap.ui.xmlfragment(
                        "<fragment_path>", this);
...
oDialog.bindElement(context.oModel.getProperty(context.getPath()));
oDialog.open();
...