是否可以隐藏sap.m.input" description"适当的价值

时间:2015-05-14 17:19:06

标签: sapui5 sap.m

我使用说明字段来保存我不想显示的值,是否可以将此属性设置为visible:false或将width设置为0?

new sap.m.Input("idAltDistInput"+refDocID+sequenceID, {value:"{AltDistrictDesc}",
description: { path : 'AltDistrictID' }
:

可见:false似乎无法正常工作。

2 个答案:

答案 0 :(得分:1)

是的,你可以通过添加StyleClass。

String host = "machinename";
     int port = 23000;
     InetAddress address = InetAddress.getByName(host);
     //establish a socket connection with server
     socket = new Socket(address, port);
     //send msg to server
     OutputStream os = socket.getOutputStream();
     OutputStreamWriter osw = new OutputStreamWriter(os);
     BufferedWriter bw = new BufferedWriter(osw);
     String request = "data";

     String sendMessage = request + "\n";
     bw.write(sendMessage);
     bw.flush();
     InputStream is = socket.getInputStream();
     InputStreamReader isr = new InputStreamReader(is);
     BufferedReader br = new BufferedReader(isr);
     String message = br.readLine();

添加以下css

sap.m.Input("id",{
   //Properties
}).addStyleClass("InputDescripTionHidden");

答案 1 :(得分:1)

您的上述评论表明您希望存储一些隐藏价值,以供日后使用。

除了“劫持”(在最好的意义上)另一个属性,你应该考虑使用专为这类事情设计的自定义数据。这是一个例子。

new sap.m.List({
    mode: "SingleSelectMaster",
    items: {
      path: "/records",
      template: new sap.m.InputListItem({
        label: "District",
        content: new sap.m.Input({
          value: "{AltDistrictDesc}",
          customData: [new sap.ui.core.CustomData({
            key: "DistrictID",
            value: "{AltDistrictID}"
          })]
        })
      })
    },
    select: function(oEvent) {
      var id = oEvent.getParameter("listItem")
        .getContent()[0] // the Input control
        .getCustomData()[0] // the only Custom Data
        .getValue();
      alert("Selected District ID : " + id);
    }
  })
  .setModel(new sap.ui.model.json.JSONModel({
    records: [{
      AltDistrictID: "D1",
      AltDistrictDesc: "District 1"
    }, {
      AltDistrictID: "D2",
      AltDistrictDesc: "District 2"
    }]
  }))
  .placeAt("content");
<script src="https://openui5.hana.ondemand.com/resources/sap-ui-core.js" id="sap-ui-bootstrap" data-sap-ui-libs="sap.m" data-sap-ui-theme="sap_bluecrystal"></script>
<div class="sapUiBody" id="content"></div>

(请注意,为简单起见,我只是在select listener中抓取第一个内容和该内容中的第一个自定义数据。您将希望在实际代码中更精确地执行此操作。)