SAPUI5 ValueHelpDialog单元格为空

编程入门 行业动态 更新时间:2024-10-26 07:39:07
本文介绍了SAPUI5 ValueHelpDialog单元格为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是编码和StackOverflow的新手.我正在尝试创建一个sapui5值帮助对话框(class sap.uip.valuehelpdialog.ValueHelpDialog),该对话框最终将过滤来自SAP后端服务中用户表的搜索请求.

I'm very new to coding and to StackOverflow. I'm trying to create a sapui5 Value Help Dialog ( class sap.uip.valuehelpdialog.ValueHelpDialog) that is supposed to end up filtering search requests from a user table in the SAP backend service.

现在,我什至无法正确显示我的模拟数据.模拟数据由一个"Personen.json"组成,其中包含具有以下字段的用户数组,例如此示例代码段:

Right now, I can't even get it to display my mockdata properly. The mockdata consists of a "Personen.json" with an array of users with the following fields like this example snippet:

[{ "BewId": "2123456789", "Posno": 1, "PNumber": "P87879876", "Firstname": "Heinz", "Company": "Some company", "IsIntern": true, "Lastname": "Wolff" }, { "BewId": "2123456789", "Posno": 2, "PNumber": "P23498711", "Firstname": "Karl", "Company": "some company", "IsIntern": true, "Lastname": "Schmidt" }]

我已经尝试了几乎所有我能想到的东西:

I've tried almost anything I can think of:

  • 在单元格的文本字段中输入文字值而不是绑定.
  • 使用getTableAsync().then代替getTable().
  • 各种不同的路径,包括整个文件夹树和/Personen的完整路径(对于我不认为的JSON当前结构没有意义).
  • 使用bindRows()而不是bindAggregation().
  • 使用sap.m.Table而不是sap.ui.table.Table在根视图上创建普通表(据我所知,这是ValueHelpDialog内部表的类型).这样可以毫无问题地显示数据.
  • 更改Personen.json的语法以在其中包含单个集合Personen,并在绑定函数中将路径更改为/Personen.
  • 尽可能地遵循样本中的示例.
  • 使用addColumn()在控制器中定义列结构,而不是像现在这样在模型中定义它:

  • Putting literal values instead of the bindings in the text field of the cells.
  • Using getTableAsync().then instead of getTable().
  • Various different paths including the full path through the entire folder tree and /Personen (which doesn't make sense with the current structure of the JSON I don't think).
  • using bindRows() instead of bindAggregation().
  • Creating a normal table on the root view with sap.m.Table instead of sap.ui.table.Table (which is the type of the internal table of the ValueHelpDialog as far as I can tell). This displayed the data without problems.
  • Changing the syntax of my Personen.json to have a single collection within it Personen and changing the path to /Personen in the binding function.
  • Following the example from the sample as closely as possible.
  • Defining the column structure in the controller with addColumn() instead of defining it in a model as I have it now:

"columnModel.json" {cols": [ { "label": "{i18n>pNumber}", "template": "{PNumber}" }, { "label": "{i18n>firstname}", "template": "{Firstname}" }, { "label": "{i18n>lastname}", "template": "{Lastname}" }]}

下面是用于在我的主视图控制器中按值帮助的事件处理程序功能:

Bellow is the event handler function for the value help press in my main view controller:

handleValueHelp: function () { var oColModel = this.getView().getModel("columnsModel"); var oUserModel = this.getView().getModel("userModel"); this._oValueHelpDialog = sap.ui.xmlfragment("appName.view.ValueHelpPopover", this); this.getView().addDependent(this._oValueHelpDialog); var oTable = this._oValueHelpDialog.getTable(); oTable.setModel(oUserModel); oTable.setModel(oColModel, "columns"); var oTemplate = new sap.m.ColumnListItem({ type: sap.m.ListType.Active, cells: [ new sap.m.Label({ text: "{PNumber}" }), new sap.m.Label({ text: "{Firstname}" }), new sap.m.Label({ text: "{Lastname}" }) ] }); if (oTable.bindRows) { oTable.bindAggregation("rows", "/"); } if (oTable.bindItems) { oTable.bindAggregation("items", "/", oTemplate); } this._oValueHelpDialog.update(); this._oValueHelpDialog.open(); }

ValueHelpDialog的我的XML视图片段:

My XML view fragment for the ValueHelpDialog:

"ValueHelpPopover.fragment.xml" <core:FragmentDefinition xmlns:vhd="sap.uip.valuehelpdialog" xmlns:core="sap.ui.core" xmlns="sap.m"> <vhd:ValueHelpDialog id="valueHelp" title="{i18n>valueHelpTitle}" ok=".onValueHelpOkPress" cancel=".onValueHelpCancelPress" afterClose=".onValueHelpAfterClose" key="Firstname" descriptionKey="Lastname"></vhd:ValueHelpDialog>

当前,我没有收到任何错误消息,但是得到了以下输出: ibb. co/q58sk1V 当我选择了行,我可以从密钥告诉他们是从我的模拟JSON OData的模型对象,但细胞的文字仍是空白.

Currently, I'm not getting any error messages, but I'm getting this output: ibb.co/q58sk1V When I select the rows, I can tell from the key that they are objects from my mock json odata model, but the cell text is still blank.

我希望绑定值PNummer,Firstname和Lastname出现在模板中所示的单元格中.

I want the binded values PNummer, Firstname, Lastname to show up in the cells as shown in the template.

我想尝试但还没有机会或不知道如何做的事情:

Things I want to try but haven't gotten the chance yet or can't figure out how:

  • 使用示例产品集
  • 在绑定上使用格式化程序,以查看实际到达单元格的内容(我的同事建议这样做).在这种情况下,我还无法弄清楚该怎么做.

任何帮助将不胜感激.

欢呼

推荐答案

由于某种原因,在值帮助"对话框的xml视图弹出窗口片段中定义了一个表,该表随后出现在实际内部表中,从而导致该问题得以解决,即使在我删除了该表,并且该代码与仍然不起作用时的代码本质上相同.关于这是为什么的任何想法?我很好奇了解这个问题.

For some reason defining a table in the xml view popover fragment of the Value Help dialog that goes bellow the actual internal table caused the problem to be fixed, even after I removed the table and the code was essentially identical to how it was when it was still not working. Any ideas as to why this was? I'm curious to understand this problem.

更多推荐

SAPUI5 ValueHelpDialog单元格为空

本文发布于:2023-11-22 09:50:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1616951.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:为空   单元格   ValueHelpDialog

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!