Skip to Content
avatar image
Former Member

Edit the cell which is clicked in sap.m.Table

I would like to edit the cell in table which is clicked using sap.m.table....

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Oct 31, 2017 at 10:33 AM

    First get the row on which you have clicked in the sap.m.table. Use the following code :

    Table in view :
    
    <Table id="table" items="{report>/results}">
    														<headerToolbar>
    															<Toolbar>
    																<Title text="{i18n>reports} :" level="H1" />
    															</Toolbar>
    														</headerToolbar>
    														<columns>
    															<Column>
    																<Text text="{i18n>name}" />
    															</Column>
    															<Column minScreenWidth="Tablet" demandPopin="true">
    																<Text text="{i18n>title}" />
    															</Column>
    															<Column minScreenWidth="Tablet" demandPopin="true">
    																<Text text="{i18n>country}" />
    															</Column>
    														</columns>
    														<items>
    															<ColumnListItem type="Active" press="onItemPress">
    																<cells>
    																	<Text text="{report>/results/0/Reportuserid}" />
    																	<Text text="{report>/results/0/Reportname}" />
    																	<Text text="{report>/results/0/Country}" />
    																</cells>
    															</ColumnListItem>
    														</items>
    													</Table>
    
    
    

    On the press event in the list execute the following function in the controller :

    /**
    			 * When the table item is pressed 
    			 * @public
    			 */
    			onItemPress:function(evt){
    				console.log(evt.getSource().getCells()[0].getText());
    			},
    

    From this you can get each of the cells on the row where the user clicks.

    Hope this helps,

    Regards.

    Add comment
    10|10000 characters needed characters exceeded

  • Oct 31, 2017 at 10:09 AM

    Hi,

    Still have issues?

    Add comment
    10|10000 characters needed characters exceeded