admin管理员组

文章数量:1022705

The dokumentation of sap.m.CustomListItem says that CustomListItem hat a press event.

I created a site with the press event on a list item, and another press event on a Button inside the list item. The button works fine. A click on the list item shows nothing. Not even an error.

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
            text: "{text}"}),
        new sap.m.Button({
            text: "btn",
            press: function(){
              alert("Pressed the button");
            }
        })
    ],
    press: function(){
      alert("Clicked the list item");
    }
});

Here is an example: ,output

The dokumentation of sap.m.CustomListItem says that CustomListItem hat a press event.

I created a site with the press event on a list item, and another press event on a Button inside the list item. The button works fine. A click on the list item shows nothing. Not even an error.

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
            text: "{text}"}),
        new sap.m.Button({
            text: "btn",
            press: function(){
              alert("Pressed the button");
            }
        })
    ],
    press: function(){
      alert("Clicked the list item");
    }
});

Here is an example: http://jsbin./pozeve/4/edit?html,output

Share Improve this question asked Dec 17, 2014 at 12:13 DerZyklopDerZyklop 3,8232 gold badges22 silver badges28 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 4

This is a frequent issue people face when they´re using List controls. There´s an answer to this here.

To put it in a nutshell, you either have to add a type property to your CustomListItem:

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
                text: "{text}"}),
            new sap.m.Button({
                text: "btn",
                press: function(){
                    alert("Pressed the button");
                   }
                })
            ],
            type : sap.m.ListType.Active,
            press: function(){
              alert("Clicked the list item");
            }
});

or a mode property to your sap.m.List. For a parison see the answer mentioned above.

The dokumentation of sap.m.CustomListItem says that CustomListItem hat a press event.

I created a site with the press event on a list item, and another press event on a Button inside the list item. The button works fine. A click on the list item shows nothing. Not even an error.

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
            text: "{text}"}),
        new sap.m.Button({
            text: "btn",
            press: function(){
              alert("Pressed the button");
            }
        })
    ],
    press: function(){
      alert("Clicked the list item");
    }
});

Here is an example: ,output

The dokumentation of sap.m.CustomListItem says that CustomListItem hat a press event.

I created a site with the press event on a list item, and another press event on a Button inside the list item. The button works fine. A click on the list item shows nothing. Not even an error.

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
            text: "{text}"}),
        new sap.m.Button({
            text: "btn",
            press: function(){
              alert("Pressed the button");
            }
        })
    ],
    press: function(){
      alert("Clicked the list item");
    }
});

Here is an example: http://jsbin./pozeve/4/edit?html,output

Share Improve this question asked Dec 17, 2014 at 12:13 DerZyklopDerZyklop 3,8232 gold badges22 silver badges28 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 4

This is a frequent issue people face when they´re using List controls. There´s an answer to this here.

To put it in a nutshell, you either have to add a type property to your CustomListItem:

var oCustomItem = new sap.m.CustomListItem({
    content: [
        new sap.m.Text({
                text: "{text}"}),
            new sap.m.Button({
                text: "btn",
                press: function(){
                    alert("Pressed the button");
                   }
                })
            ],
            type : sap.m.ListType.Active,
            press: function(){
              alert("Clicked the list item");
            }
});

or a mode property to your sap.m.List. For a parison see the answer mentioned above.

本文标签: javascriptEvent quotpressquot on sapmCustomListItem doesn39t workStack Overflow