为什么文本从文本区域消失?

时间:2019-05-15 13:58:15

标签: sapui5

我在一个简单表单内有一个文本区域,该表单在对话框内。当我第一次尝试将粘贴文本复制到文本区域时,文本消失。在粘贴文本之前,我必须做几次。我想知道为什么会这样。这是UI5故障吗?

这是我的代码。问题文本区域的ID为value_long,关键字,Intersection1和Intersection2。我可以将文本键入文本区域而不会出现任何问题。包含62个字符或更多字符的文本的复制粘贴导致出现此问题。

var dialog = new Dialog({
                title: "Create Flow Record",
                type: "Message",
                content: [
                    new SimpleForm({
                        content: [
                            new Label({
                                text: "Id"
                            }),
                            new Input({
                                id: this.getView().createId("Id"),
                                value: "",
                                placeholder: "ID"
                            }),
                            new Label({
                                text: "Body"
                            }),
                            new TextArea({
                                id: this.getView().createId("value_long"),
                                value: "",
                                growing: true,
                                growingMaxLines: 7,
                                placeholder: "Body",
                                width: "100%"
                            }),
                            new Label({
                                text: "Type"
                            }),
                            new Select({
                                id: this.getView().createId("Type"),
                                autoAdjustWidth: true
                            }).bindAggregation("items", "typeDropDown>/type", oTypeItem),
                            new Label({
                                text: "Action"
                            }),
                            new Input({
                                id: this.getView().createId("Action"),
                                value: "",
                                placeholder: "Action"
                            }),
                            new Label({
                                text: "Button1"
                            }),
                            new Input({
                                id: this.getView().createId("Button1"),
                                value: "",
                                placeholder: "Button1"
                            }),
                            new Label({
                                text: "Button2"
                            }),
                            new Input({
                                id: this.getView().createId("Button2"),
                                value: "",
                                placeholder: "Button2"
                            }),
                            new Label({
                                text: "Button3"
                            }),
                            new Input({
                                id: this.getView().createId("Button3"),
                                value: "",
                                placeholder: "Button3"
                            }),
                            new Label({
                                text: "Button4"
                            }),
                            new Input({
                                id: this.getView().createId("Button4"),
                                value: "",
                                placeholder: "Button4"
                            }),
                            new Label({
                                text: "Button5"
                            }),
                            new Input({
                                id: this.getView().createId("Button5"),
                                value: "",
                                placeholder: "Button5"
                            }),
                            new Label({
                                text: "Button6"
                            }),
                            new Input({
                                id: this.getView().createId("Button6"),
                                value: "",
                                placeholder: "Button6"
                            }),
                            new Label({
                                text: "Active"
                            }),
                            new Select({
                                id: this.getView().createId("Active_Flag"),
                                autoAdjustWidth: true
                            }).bindAggregation("items", "activeFlagDropDown>/activeFlag", oActiveFlagItem)
                        ]
                    })
                ],
                buttons: [
                    new Button({
                        text: "Create Flow Record",
                        press: function () { //ajax calls send the new id to the database
                            oData.value = this.byId("Id").getValue() + "|" + this.byId("value_long").getValue() + "|" + this.byId("Type").getSelectedItem()
                                .getText() +
                                "|" + this.byId("Action").getValue() + "|" + this.byId("Button1").getValue() + "|" + this.byId("Button2").getValue() +
                                "|" + this.byId("Button3").getValue() + "|" + this.byId("Button4").getValue() + "|" + this.byId("Button5").getValue() +
                                "|" + this.byId("Button6").getValue() + "|" + this.byId("Active_Flag").getSelectedItem().getText();
                            $.ajax({
                                url: "private url",
                                type: "POST",
                                data: JSON.stringify(oData),
                                contentType: "application/json",
                                success: function (data) {
                                    this.setModel(new JSONModel(data), "garows");
                                }.bind(this),
                                error: function (e) {
                                    MessageToast.show("Data error. Please correct and try again. Refresh the page, if needed.");
                                }
                            });
                            dialog.close();
                        }.bind(this)
                    }),
                    new Button({
                        text: "Cancel",
                        press: function () {
                            dialog.close();
                        }
                    })
                ],
                afterClose: function () {
                    dialog.destroy();
                }
            });
            this.getView().addDependent(dialog);
            dialog.open();


var dialog = new Dialog({
                title: "Create Keywords Record",
                type: "Message",
                content: [
                    new SimpleForm({
                        content: [
                            new Label({
                                text: "Keywords"
                            }),
                            new TextArea({
                                id: this.getView().createId("Keywords"),
                                value: "",
                                growing: true,
                                growingMaxLines: 7,
                                placeholder: "Keywords",
                                width: "100%"
                            }),
                            new Label({
                                text: "Intersections1"
                            }),
                            new TextArea({
                                id: this.getView().createId("Intersection1"),
                                value: "",
                                growing: true,
                                growingMaxLines: 7,
                                placeholder: "Intersections1",
                                width: "100%"
                            }),
                            new Label({
                                text: "Intersections2"
                            }),
                            new TextArea({
                                id: this.getView().createId("Intersection2"),
                                value: "",
                                growing: true,
                                growingMaxLines: 7,
                                placeholder: "Intersections2",
                                width: "100%"
                            }),
                            new Label({
                                text: "Logic_Group"
                            }),
                            new Input({
                                id: this.getView().createId("Logic_Group"),
                                value: "",
                                placeholder: "Logic_Group",
                                width: "30%",
                                type: "Number"
                            }),
                            new Label({
                                text: "Logic_Order"
                            }),
                            new Input({
                                id: this.getView().createId("Logic_Order"),
                                value: "",
                                placeholder: "Logic_Order",
                                width: "30%",
                                type: "Number"
                            }),
                            new Label({
                                text: "Points"
                            }),
                            new Input({
                                id: this.getView().createId("Points"),
                                value: "",
                                placeholder: "Points",
                                width: "30%",
                                type: "Number"
                            })
                        ]
                    })
                ],
                buttons: [
                    new Button({
                        text: "Create Keywords Record",
                        press: function () { //ajax call sends keywords to the database
                            oData.value = this.getModel("title").getProperty("/pageTitle") + "|" + this.byId("Keywords").getValue() + "|" + this.byId(
                                    "Intersection1").getValue() +
                                "|" + this.byId("Intersection2").getValue() + "|" + this.byId("Logic_Group").getValue() + "|" + this.byId("Logic_Order").getValue() +
                                "|" + this.byId("Points").getValue();
                            $.ajax({
                                url: "private url",
                                type: "POST",
                                data: JSON.stringify(oData),
                                contentType: "application/json",
                                success: function (data) {
                                    this.setModel(new JSONModel(data), "gakrows");
                                }.bind(this),
                                error: function (e) {
                                    MessageToast.show("Data error. Please correct and try again. Refresh the page, if needed.");
                                }
                            });
                            dialog.close();
                        }.bind(this)
                    }),
                    new Button({
                        text: "Cancel",
                        press: function () {
                            dialog.close();
                        }
                    })
                ],
                afterClose: function () {
                    dialog.destroy();
                }
            });
            this.getView().addDependent(dialog);
            dialog.open();

预期结果是能够将62个字符或更多字符的文本粘贴到文本区域中。

0 个答案:

没有答案