Show TOC

CHIP Instance TitleLocate this document in the navigation structure

A client-side page builder is expected to display and maintain a title for each CHIP instance (sap.ui2.srvc.ChipInstance). This title can be read using getTitle() and written using setTitle(sTitle, true).
      function onTitleChange(oTitleControl, oChipInstance) {
        oTitleControl.setText(oChipInstance.getTitle());
      }
      function onSuccess(oLayout, oPage) {
        var aChipInstances = oPage.getChipInstances(),
          i,
          n,
          oChipInstance,
          oTitleControl;
        for (i = 0, n = aChipInstances.length; i < n; i += 1) {
          oChipInstance = aChipInstances[i];
          oTitleControl = new sap.ui.commons.TextView({
            text: oChipInstance.getTitle()
          });
          oChipInstance.attachTitleChange(onTitleChange.bind(null, oTitleControl));
          oLayout.addContent(oTitleControl)
            .addContent(oChipInstance.getImplementationAsSapui5());
        }
      }
Note The example code above does not yet support editing of the title. However, it already uses the callback mechanism of the ChipInstance class on title changes. Therefore, if you later add an API allowing the CHIP to change its own title, this will not require any change in the page builder.

For more information, see Class sap.ui2.srvc.ChipInstance.