openui5: Comment obtenir de l'actuel JSON élément de modèle dans RowRepeater

Je vais avoir de la difficulté à obtenir l'actuel JSON modèle élément qui est lié à un RowRepeater élément.
Avec des tableaux et des listes, je voudrais simplement récupérer l'indice actuel (ou indices) et sur la base de ces valeurs, je les ai point à l'élément correspondant dans mon JSON modèle.

Cependant, la RowRepeater élément n'a pas un indice actuel de la propriété. Comme je sens que je devrais être en mesure de récupérer l'élément courant directement, plutôt indirectement par l'indice actuel, est-il mieux, de façon uniforme pour récupérer l'élément courant?

Exemple de code de modèle :

    var mydata = {
        "data": [
            {
                "key": "67b895bf-8d89-11e3-94a7-0000005341de",
                "name": "my 1st item"
            },
            {
                "key": "7780de05-8d83-11e3-bec4-0000005341de",
                "name": "my 2nd item"
            }
        ]
    };
    var oModel = new sap.ui.model.json.JSONModel();
    oModel.setData(dummydata);
    sap.ui.getCore().setModel(oModel);

Exemple de code pour RowRepeater (je veux retrouver la " clé " en appuyant sur l'icône de suppression):

    var oRowRepeater = new sap.ui.commons.RowRepeater();

    //create the template control that will be repeated and will display the data
    var oRowTemplate = new sap.ui.commons.layout.MatrixLayout();

    var  matrixRow, matrixCell, control;

    //main row
    matrixRow = new sap.ui.commons.layout.MatrixLayoutRow();

    //Text
    control = new sap.ui.commons.TextView();
    control.bindProperty("text","name");

    //add content to cell, cell to row
    matrixCell = new sap.ui.commons.layout.MatrixLayoutCell();
    matrixCell.addContent(control);
    matrixRow.addCell(matrixCell);

    //delete icon
    var icon = new sap.ui.core.Icon({
        src: sap.ui.core.IconPool.getIconURI("delete"),
        size: "16px",
        color: "#333",
        activeColor: "#BBB",
        hoverColor: "#888",
        width: "60px",
    });
    icon.attachPress(function(oEvent) {
        sap.ui.commons.MessageBox.alert("TODO: Implement delete based on current/data/?/key");
    });

    //add content to cell, cell to row
    matrixCell = new sap.ui.commons.layout.MatrixLayoutCell({ hAlign : sap.ui.commons.layout.HAlign.Right });
    matrixCell.addContent(icon);
    matrixRow.addCell(matrixCell);

    //add row to matrix
    oRowTemplate.addRow(matrixRow);

    //attach data to the RowRepeater
    oRowRepeater.bindRows("/data", oRowTemplate);

OriginalL'auteur Qualiture | 2014-02-06