标签: sapui5

我如何设置片段元素的值?

这是我的片段,片段没有控制器

<core:FragmentDefinition
  xmlns="sap.m"
  xmlns:core="sap.ui.core">
  <Dialog
    title="Invio report via mail">
    <content>

        <FlexBox
            alignItems="Start"
            justifyContent="Center">
            <items>
             <TextArea id="idMailReport" value="themail.mail.it" rows="1" cols="50" /> 
            </items>
        </FlexBox>



    </content>
    <beginButton>
      <Button text="Ok" press="onDialogOkButton" />
    </beginButton>
    <endButton>
      <Button text="Close" press="onDialogCloseButton" />
    </endButton>
  </Dialog>


</core:FragmentDefinition>
Run Code Online (Sandbox Code Playgroud)

我可以设置TextArea元素的che值吗?

我尝试从我调用片段的控制器设置它:

var dialogFrafment = sap.ui.xmlfragment(
                "dialogFragment",
                "appIntra.fragment.dialog",
                this // associate controller with the fragment
          );
          this.getView().addDependent(dialogFrafment);
          dialogFrafment.open();
          this.byId("idMailReport").setValue("initial.mail.com");
Run Code Online (Sandbox Code Playgroud)

你能帮助我吗?

sapui5

0
推荐指数
1
解决办法
2万
查看次数

如何使用SAP UI5 xml视图

我是SAP UI5的新手.

我的任务是将javascript代码转换为xml视图.这里javascript就像:

 var sHtmlText = '<strong>Aliquam erat volutpat.</strong><br>Vivamus vitae felis nec lacus ultricies dapibus condimentum quis felis.';
    sHtmlText += 'Some link goes here:<embed data-index=\"0\">';

    var oLink2 = new sap.ui.commons.Link("l2", {
        text : "Click me",
        href : "http://scn.sap.com/welcome",
        title : "SAP Community Network",
        target : "_blank"
    });

    var oFTV2 = new sap.ui.commons.FormattedTextView("otv2");
    //set the text with placeholders inside
    oFTV2.setHtmlText(sHtmlText);
    //add the desired control to the FormattedTextView
    oFTV2.addControl(oLink2);

    var oCallout = new sap.ui.commons.Callout({
        content : oFTV2
    });

    // create a sample …
Run Code Online (Sandbox Code Playgroud)

sapui5

0
推荐指数
1
解决办法
5904
查看次数

添加到数组javascript

我创建了数组var aData = [];,我想使用Web服务添加到数组.我使用了以下代码来检索最后一项:

var GSUserAfterFindRecord = function (sender) {
    UserVM.ModelList = ko.observableArray(UserVM.Model.GetDataList());
    var list = {};

    $.each(UserVM.Model.GetDataList(), function (index, item) {
        list = { name: item.Name };
    });
    aData.push(list);
    oModel.refresh();
}
Run Code Online (Sandbox Code Playgroud)

但我想要检索所有项目而不仅仅是最后一项.而不是list = { name: item.Name };我尝试list += { name: item.Name }但返回一个空白表.我曾经console.log看过什么被推送到aData,当添加+我得到:["[object Object][object Object][object Object][obje…ect][object Object][object Object][object Object]"]没有+我得到[Object].

我应该提一下,我使用的是sapui5表,这就是我的原因,oModel.refresh但我认为这可以在不知道我使用sapui5表的情况下完成.

javascript arrays sapui5

0
推荐指数
1
解决办法
980
查看次数

如何在输入字段中添加验证?

刚学习SAP UI5,我有一个简单的输入字段,如下所示:

app.xml中

<Input
    placeholder="Please enter 10 digit number"
    value=""
/Input>
Run Code Online (Sandbox Code Playgroud)

我试图了解如何在输入字段上添加验证,执行以下操作:

- 接受10位数或更多位数

到目前为止,据我所知,这可以通过以下方式设置:

<Input value=”{

    path : ‘/userName’,
    type : ‘sap.ui.model.type.Integer’,
    constraints : {
        minLength : 10
    }
}
Run Code Online (Sandbox Code Playgroud)

我感到困惑的地方:

输入字段用作搜索栏,因此我不需要引入数据绑定(搜索栏不应该有初始值),我必须在其中配置路径.有人可以向我解释如何在不设置"路径"的情况下添加验证吗?

validation sapui5

0
推荐指数
1
解决办法
8235
查看次数

如何在XML视图中从SAPUI5应用程序中的字符串中删除前导零?

我在SAPDB中有一个整数但由于某种原因它必须存储为NUMERIC,并且数值在SAP DB中存储为字符串.

因此OData服务返回0000000001而不是1.

那么问题是如何在XML视图中删除前导零.问题是我使用XML View时无法使用Javascript进行格式化.

我找到的唯一解决方案是使用这样的代码:

<Text text="{path:'ZId', type:'sap.ui.model.odata.type.ODataType', oConstraints:{isDigitSequence: true}}" />
Run Code Online (Sandbox Code Playgroud)

但我不知道为什么它没有删除前导零,而在其参考文献中已经说过:

if true, the value is handled as a sequence of digits; while formatting leading zeros are removed from the value and while parsing the value is enhanced with leading zeros (if a maxLength constraint is given) or leading zeros are removed from the value (if no maxLength constraint is given); this constraint is supported since 1.35.0. To make this type behave as ABAP …

sapui5

0
推荐指数
1
解决办法
3969
查看次数

如何在jQuery.ajax()的完整属性中调用的函数中返回?

您好我在jQuery.ajax调用下使用,在我的onBeforeRendering()方法中:

onBeforeRendering: function() {
jQuery.ajax({
            url: "/prototype/OnlineQuestionnaire/getQuestionsAndResponseChoices.xsjs?questionnaireResponseId=" + escape(
                questionnaireResponseId) + "&password=" + escape(
                password),
            //  url: "/prototype/OnlineQuestionnaire/submitAndCreateQuestionnaire.xsjs",
            method: "GET",
            dataType: "json",
            complete: this.onSuccess,
            error: this.onErrorCall
        });
console.log(output);   //Gives undefined
}
onSuccess: function(jqXHR, textStatus) {
        output = jqXHR.responseText;
        output = JSON.parse(output);
        console.log(output)  //Gives me my JSON object from my response.
        return;
    },
Run Code Online (Sandbox Code Playgroud)

为什么console.log(output)我的onBeforeRendering函数中没有给我定义?我想在我的onBeforeRendering中获取输出结果,以便我可以在渲染之前执行一些验证.在我得到一个解决方法的那一刻,我在收到输出后在onSuccess函数中执行我的验证.但我希望在onBeforeRendering()中调用ajax后执行此操作.但我尝试了console.log(输出)未定​​义.如何从我的ajax调用的完整属性访问输出?

ajax jquery sapui5

0
推荐指数
1
解决办法
127
查看次数

如何清除文本区域

XML视图

<TextArea id="message"
  maxLength="100"
  width="100%"
  valueLiveUpdate="true"
  showExceededText="false"
  placeholder="Type here.."
  required="true"
/>
Run Code Online (Sandbox Code Playgroud)

调节器

onInit: function() {
  // ...
  this.getView().byId("message").setText("");
},
Run Code Online (Sandbox Code Playgroud)

在这里,我尝试了两个命令来清除文本区域值.但是得到了错误

  • this.getView().byId("message").setText("");

    TypeError:this.getView(...).byId(...).setText不是函数

  • sap.ui.getCore().byId("message").setText("");

    TypeError:sap.ui.getCore(...).byId(...)未定义.

如何从JS中清除TextArea值?

sapui5

0
推荐指数
1
解决办法
982
查看次数

如何使用OData模型获取项目表值?

我有一个OData模型,数据如下

在此输入图像描述

在这里,Under ZRECRUITMENT_TRACERRzSet(1),我有" toCandidates"这是关联,它有项目级数据.

如何在控制器中访问它的值.

我试过用

oModel.getProperty('/ZRECRUITMENT_TRACERRzSet(1)/toCandidates')
Run Code Online (Sandbox Code Playgroud)

但它没有帮助.

odata sapui5

0
推荐指数
1
解决办法
148
查看次数

SAPUI5奇怪的数据绑定行为

这是非常愚蠢的问题,但我不知道它为什么会发生.我在控制器中发现了这个:

this.getView().setModel(this.placesModel, "myCity");
Run Code Online (Sandbox Code Playgroud)

然后我用Ajax请求将数据设置到我的快速RESTFull应用程序和View.xml中

  <List items="{path: 'myCity>/people'}">
      <CustomListItem>                           
          <VBox>
            <Title text="Person:"/>
            <Label text="{myCity>/people/name}"/>
            <Label text="{myCity>/people/age}"/>
          </VBox>            
        </CustomListItem>
   </List>
Run Code Online (Sandbox Code Playgroud)

我有myCity几个属性的对象.其中一个是对象people,它是一组对象.当我尝试列出这些时,我可以看到我的所有人都被列出但没有相应的姓名和年龄.此外,我发现很难>/何时何时使用>/.

sapui5

0
推荐指数
1
解决办法
49
查看次数

如何使进度指示器响应

我参考以下示例-进度指示器 (在垂直布局中完成)在水平布局中制作了3个进度指示器:

<l:HorizontalLayout
        class="sapUiContentPadding"
        width="100%">
        <l:content>
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="30"
                displayValue="30%"
                showValue="true"
                width="28.7rem"
                state="None" />
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="50"
                showValue="false"
                width="28.7rem"
                state="Error" />
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="99"
                displayValue="0.99GB of 1GB"
                showValue="true"
                width="28.7rem"
                state="Success" />
        </l:content>
    </l:HorizontalLayout>
Run Code Online (Sandbox Code Playgroud)

为了使屏幕与我使用的3个指示器大小相等,width="28.7rem"但这可能不是正确的方法,并且也不响应(已知)

结果图片:

同一行有3个进度指示器

为了使它具有响应性,我读到我应该将整个东西包装在flex框中,所以我尝试如下操作:

<l:content>
         <Panel class="sapUiDemoFlexBoxSizeAdjustments">
            <FlexBox
                alignItems="Start">
                    <items>
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="30"
                displayValue="30%"
                showValue="true"
                width="100%"
                state="None" />
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="50"
                showValue="false"
                width="100%"
                state="Error" />
            <ProgressIndicator
                class="sapUiSmallMarginBottom"
                percentValue="99"
                displayValue="0.99GB of 1GB"
                showValue="true"
                width="100%"
                state="Success" />
                    </items>
            </FlexBox>
          </Panel>
        </l:content>
    </l:HorizontalLayout>
Run Code Online (Sandbox Code Playgroud)

但这也没有帮助我(我想我的代码是错误的)。

我可以知道如何实现这些响应进度指标吗?

nsprogressindicator responsive-design sapui5

0
推荐指数
1
解决办法
77
查看次数